Add json file comments

Possible Duplicate:
Can I comment a JSON file?

We are using a .json file on a project. We want to know if we can add comments to the file and avoid crashing the JSON parser.

  • Textmate shortcut for add/remove HTML or JavaScript comments
  • Is it possible to get reference to comment element/block by JavaScript?
  • Retrieve javascript comments in javascript, or, how do I parse js in js?
  • Rails comments not rendering with ajax
  • I don't understand this Javascript comment-like code, can someone clarify this?
  • Javascript Comments are security risk?
  • We’ve tried to do so with the following comment types, but they all crash the JSON file when it’s parsed:

    # I crash
    // I crash
    /* I crash */

    Is there an acceptable form of commenting for JSON files?

  • Automatically “continue” a comment block in Sublime when pressing enter?
  • Comments in angularjs expression
  • Jsdoc3 commenting object
  • Facebook comments and likes problem
  • Strip comments from javascript file
  • Textmate shortcut for add/remove HTML or JavaScript comments
  • 2 Solutions collect form web for “Add json file comments”

    JSON doesn’t support comments – which is good when you think about it. However, someone has made JSON5 (, which does, and may be of use to you.

    It’s worth pointing out that this is just someones JSON-like project, and is not an official spec, but then I guess JSON is just someones XML-like project that people liked 🙂

    The standard JSON format doesn’t explicitly support file comments. RFC 4627 application/json

    It’s a lightweight format for storing and transferring data. If the comment is truly important, you can include it as another data field like comments: "my comment".


        name: "Bob",
        age: 5,
        comments: "I don't like him"

    However if it’s being used in this format, it really is just another piece of data. So ultimately, what you have to realize is that just because certain fields are there doesn’t mean you have to use it.