3 ms·
The difference between rendering strings and numbers as HTML is not very clear, and could probably be improved (by using quotes around strings). A faded green 2
by devinj 17y ago
The difference between rendering strings and numbers as HTML is not very clear, and could probably be improved (by using quotes around strings). A faded green 2 is a string ("2"). A bright green 2 is a number.
Also, "Strict JSON" is not very strict (it permits numeric keys and implicitly converts them to strings, which is not within the JSON spec). I'm not sure if there are any other problems with it, nor if this is really the fault of the app or some code it uses (I didn't bother to check any of the internals).
- altearius 17y agoI'm afraid I'm not terribly good at color schemes, being color blind. If you would like to suggest an alternative color, I'll certainly consider it. "Strict JSON" makes use of the YUI JSON tool (2.6.0) for parsing, which disallows a few things: functions, regex objects, etc. Thus, the idea behind "Strict JSON" mode is to ensure that the provided JSON may be parsed by a JSON-parsing library, as opposed to requiring eval (I wrote this before native JSON support was available in most browsers). I have not attempted to make my own "strict" JSON parser because I'm not sure what additional benefit would be gained from doing so. JSLint already has a perfectly functional JSON-checking mode that will give warnings about anything I would consider warning about. Thanks for the comments!
- devinj 17y agoSorry for not getting back to you, not used to HN yet. It's not that the color scheme is hard to see-- I can tell apart faded and bright green fine enough for the purposes of discriminating that they are different. What I can't tell is whether faded is numbers and bright is strings, or vice versa. It's not really obvious, and probably isn't no matter what color you pick (although red seems to be exclusive to strings in all the highlighting schemes I've used) no matter which colors you pick, is what the problem really is-- perhaps, instead, you could enclose strings with quote marks.