JSON Comments


#1

My project is using Chef-Solo. We will have lots of run lists (if nothing else)
in JSON files. We would like to put comment headers on the JSON files
indicating which project developed them, which developer developed them, date
of development, etc.

I looked on Stack Overflow and got about ten contradictory answers regarding
whether or nor JSON files can have comments.

We are not trying to do anything magical. We will leave the comment headers out
of our JSON files if it proves to be too complex, but I figured I might as well
ask if OpsCode in particluar or Chef developers in general have a simple,
canonical method of adding comments to JSON files.


#2

Hi,

On Thu, Nov 22, 2012 at 6:06 AM, Marvin W. Hile marvin.hile@raytheon.comwrote:

I looked on Stack Overflow and got about ten contradictory answers
regarding
whether or nor JSON files can have comments.

Comments are not part of the json standard. See http://json.org/

We are not trying to do anything magical. We will leave the comment
headers out
of our JSON files if it proves to be too complex, but I figured I might as
well
ask if OpsCode in particluar or Chef developers in general have a simple,
canonical method of adding comments to JSON files.

We use the ruby variants when defining roles, environments etc. This is
partially so we can have comments in there as it is just ruby code. At the
current time we have not figured out a good way to comment our data bag
values.


Cheers,

Peter Donald