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 Lazaro de Lara
  • 2,540
  • 6
  • 26
  • 41
Rehan Ch
  • 805
  • 3
  • 13
  • 18

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
  • 12,008
  • 3
  • 36
  • 53
4

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

Paco Barter
  • 182
  • 1
  • 3