3 ms·
I've done something like this: {"height": 100, "width": 150", "__comment__": "This is a comment"} Of course depending on the implementation details this may
by orangecat 15y ago
I've done something like this:
{"height": 100, "width": 150",
"__comment__": "This is a comment"}
Of course depending on the implementation details this may keep the comment string in memory. I agree JSON should have native comments, as well as optional trailing commas.
- alavrik 15y agoI don't think JSON as a _data interchange format_ should have comments. Key factors contributing to JSON's popularity and great practical value is simplicity and the fact that JSON is a final specification (i.e. no versioning, no extensions, no backward compatibility requirements). Although JSON is human-readable, it wasn't specifically designed for human interaction. There are other projects and languages that address this specific topic. For example, Yaml and Piq. (Piq is the one that I'm working on as a part of the Piqi project -- http://piqi.org http://piqi.org).