Comments in JSON

JSON has no comments. RFC 8259 lists everything a JSON text can contain, and // and /* */ aren't in it. Formats built on JSON, like JSONC (used by VS Code settings and tsconfig.json) and JSON5, do allow them, which is how comments end up in files that a strict parser like JSON.parse then rejects.

In Chrome and Node.js, JSON.parse says: Expected property name or '}' in JSON

Broken
{
  // The user's display name
  "name": "Ada Lovelace",
  "born": 1815 /* year */
}
Fixed
{
  "name": "Ada Lovelace",
  "born": 1815
}

Fix it by hand

Delete each comment. If a note has to stay with the data, make it a value, like "_note": "...".

Open this example in j2n