7 October 2011

How i can add comment to json

No, you can't add comment  to JSON.

First. If you need  comment in data ,that usually means that your naming convention , design are rubbish and documentation sucks, because .... Data should be self-explanatory .

Second. It is a  data-interchange format. Devices need understand this crap,not humans.

Third. You can complain on your blogs,go to psychologist to talk about it,but  no, you can't add comment  to JSON.

So... what to do?
If you really despeard to put your /*comment*/ , then you can emulate them by add   name/pair value
like :
"__comment__" : "i am addicted from add useless comment"   which should be  ignored by your application that use the JSON data,  but comment will be visible all the time and consume your bandwith and i'm afraid is nothing what you can do about it (except do NOT use comment in first place) andI don't feel sorry about your problem.

Example:
{
  "__comment__" : "justin bieder is is good as music as I in commenting my code",

"mySkills": "rubbish",  
"your" :  "json  stuff"
}