Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm considering extending JSON by adding comment. For just my own project, internally.

If JSON got a comment, I think its syntax should be //~\n style, JavaScript syntax. How do you think?

share|improve this question

closed as not constructive by MichaelT, GlenH7, Jalayn, Yusubov, BЈовић Apr 26 '13 at 21:52

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

2  
Don't call it JSON, but EonilJSON :) –  David Mar 18 '11 at 7:35
    
@David Absolutely :) –  Eonil Mar 18 '11 at 7:37
    

3 Answers 3

up vote 1 down vote accepted

For internal purposes, I don't see any problem. The JSON-decoder I use can handle comments, trailing commas and identifiers as object field names. And basically, you should always use a decoder that is forgiving (very useful for handwritten config files or when loading data from people who have a poor encoder).

However, if you use JSON to pass data to other applications, you better stick to the standard.

Alternatively, you may want to use YAML. It supports comments and a lot of other features and contains JSON as a subset. It is not very well known, but IMHO the most powerful human readable serialization format (except actual programming languages :D).

share|improve this answer

The JSON Specification does not support comments. So no.

share|improve this answer
    
I think the question is about implementing an extention to the JSON Specification. Which would be rather useless if the JSON Specification already included comments –  Martijn Sep 23 '11 at 11:09
    
-1 because you seem not to have read the question carefully. –  nalply Aug 12 '12 at 9:00
    

I would prefer to add a comment property to the root map.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.