Comments in JSON

JSON does not have comments. A JSON encoder MUST NOT output comments. Douglas Crockford - creator of json

Want to use comments in JSON even though Douglas doesn’t want you to :)

Using ini, apache, xml, html or // comment formats invalidate your JSON files


    "name": "Jack (\"Bee\") Nimble", //varchar
        "format": {
            "type":       "rect", //varchar - max 4 characters
            "width":      1920, //int
            "height":     1080, //int
            "interlace":  false, //boolean
            "frame rate": 24 //int

As Douglas stated, JSON has no offical support for comments, but it doesn’t mean you can’t add them in other ways

The best way I’ve found to add comments into JSON is to add _comment style elements - after the element your commenting on - into the JSON. Refer below for a valid JSON file with comments.


    "name": "Jack (\"Bee\") Nimble", 
        "format": {
            "type":       "rect", 
            "_type_comment": "varchar - max 4 characters",
            "width":      1920, 
            "_width_comment": "int",
            "height":     1080, 
            "_height_comment": "int",
            "interlace":  false, 
            "_interlace_comment": "boolean",
            "frame rate": 24,
            "_frame_rate_comment": "int"


  • Make sure your app ignores the _comment elements
  • Use to validate your JSON

Let me know if you have a better way to do valid comments in JSON

Justin Kelly

Justin Kelly

Web Developer, Business Analytics, Data Engineer specialising in PHP and Tableau

Based in Melbourne, Australia

Feel free to contact me or _justin_kelly


krutik khatri

Hii You can also use for json validator,beautify,minify,xml,yaml,CSV,bson,plain text,base64,tsv. Do checkout this site!

This is a unique place for fashionable women’s clothing and accessories. We offer our clients women’s clothing, jewelry, cosmetics and health products, shoes, bags and much more.

You: Great. Do this. But can I ask what you’ve been doing up to date? Why do you think you aren’t getting more comments? Your reader: Well, I haven’t tried what you just proposed, and I think it’s a great solution. So far, I’ve been wrapping up my posts nice and tightly but it feels like I’m cutting off the circulation, 카지노사이트

Leave a comment

Notify me of replies by email.