How to add comments to JSON files

JSON was designed to be a data only format, and deliberately does not support comments to avoid parsing directives which could break compatibility.

There is a way to add comments as custom elements:

    "//comment_1": "This is the first comment.",
    "//comment_2": "This is the second comment.",
    "Name": "John von Neumann",
    "Born": 1903,
    "item": {
        "//item_comment_1": "A nested comment.",
        "//item_comment_2": "Another nested comment.",
        "Field": "Computer science"

Leave a comment

Your email address will not be published. Required fields are marked *