Validating sgml parser single dating sites for seniors
If you'd like to annotate your JSON with comments (thus making it invalid JSON), then minify it before parsing or transmitting.
Crockford himself acknowledged this in 2012 in the context of configuration [email protected]: When it comes to formal grammars, there must be something that explicitly says that they are allowed, not the other way around.
I admire your gumption, but you're kinda re-inventing YAML.
If you want lot's of flexibility and human readability, use YAML (don't actually: stackoverflow.com/questions/450399/…) or stick with curmudgeony, yet unambiguous JSON.
Not all JSON parsers will understand this sort of JSON. It's an interesting curiosity, but you should really not be using it for anything at all. I've found a little hack that allows you to place comments in a JSON file that will not affect the parsing, or alter the data being represented in any way.
It appears that when declaring an object literal you can specify two values with the same key, and the last one takes precedence.
For instance, take your programming language of choice: Just because some desired (but missing) feature isn't explicitly disallowed, doesn't mean that your compiler will magically recognize it. The JSON format has a lot of dead-space between elements and is space-insensitive in those regions, so there's no reason why you can't have single or multi-line comments there.
Many parsers and minifiers support JSON comments as well, so just make sure your parser supports them.
Example: JSON can serve as an application configuration file. I removed comments from JSON because I saw people were using them to hold parsing directives, a practice which would have destroyed interoperability.Don't go judging people as terrible developers easily. Perhaps you might reconsider your "well-defined JSON is your opinion" view after reading ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf It is a real standard and devs implementing their own "special" versions leads to fragmentation, confusion and a lot of wasted time.Look at the mess web developers are left with when writing code just because each browser implements slightly different versions of standards.It includes this notable comment from the creator of JSON: Suppose you are using JSON to keep configuration files, which you would like to annotate. Then pipe it through JSMin before handing it to your JSON parser.- Douglas Crockford, 2012 The only problem I have with JSON.minify() is that it is really really slow.