4

Can you and what would be the best way to add comments to a JSON file?

I've used //comments and "_comment"

VBM46
  • 43
  • 1
  • 4

1 Answers1

1

No, comments of the form //… or /*…*/ are not allowed in JSON. This answer is based on:

  • https://www.json.org
  • RFC 4627: The application/json Media Type for JavaScript Object Notation (JSON)
  • RFC 8259 The JavaScript Object Notation (JSON) Data Interchange Format (supercedes RFCs 4627, 7158, 7159)

Ref: https://stackoverflow.com/a/4183018/

danny26b
  • 463
  • 2
  • 13
  • 2
    This was plagiarized straight from https://stackoverflow.com/a/4183018/ minus a few links. Please don't copy content without attribution - see https://stackoverflow.com/help/referencing. – Ollie Jun 22 '22 at 16:50
  • 2
    @Ollie, forgot that, my bad. Answer was updated. – danny26b Jun 22 '22 at 16:52