This Angular tutorial helps you get started with Angular quickly and effectively through many practical examples.

JSON Comment

JSON Comment

JSON is not a programming or scripting language but used by Programming and scripting languages like JavaScript, PHP, Python, C#, Java, etc. There is no natural way to comment on data in JSON. We can use the JSON key to build our own comment structure even though JSON does not by default support comments.

Douglas Crockford wrote:

"I removed comments from JSON because I saw people were using them to hold parsing directives, a practice which would have destroyed interoperability, writes Douglas Crockford, who popularized the text-based data format."

The following example JSON stores the name and age values with the _comment key which is used for commenting.

   "name": "Rohatash", "age": 35,
    "_comment": "This is a comment",

Here _comment Key can be treated as comment.

Prev Next