8

How do I add comments in a simple JSON file which be read from s3 in AWS. This is my JSON file.

{
    "Parameters": {
        "KeyPairName": "mykey",
        "InstanceTypes": "t2.micro",

        "prodImageIds": "ami-d7abd1b8",
        "testImageIds": "ami-e41b618b",
        "devImageIds": "ami-8f8afde0"
    },
    "StackPolicy": {
        "Statement": [
            {
                "Effect": "Allow",
                "NotAction": "Update:Delete",
                "Principal": "*",
                "Resource": "*"
            }
        ]
    }
}
Albert Lázaro de Lara
  • 2,363
  • 5
  • 25
  • 36
Rehan Ch
  • 765
  • 2
  • 10
  • 15

2 Answers2

10

JSON specification doesn't include comments of any kind. You can simply add a standard key/value pair with a key that gets ignored by the application (maybe _comment) but there is no way to insert a proper comment.

Here the spec details: http://www.json.org/

whites11
  • 10,132
  • 3
  • 28
  • 43
3

I usually do something like adding "------------------------------------------" : "------------------------------------------" to visually separate "sections".

Paco Barter
  • 172
  • 1
  • 3