JSON comments not allowed

Comments are common in config-like formats, but standard JSON does not support them. Even a single comment can make the entire payload invalid.

Broken example

{
  // This is invalid JSON
  "enabled": true
}

Corrected example

{
  "enabled": true
}

Why this error happens

JSON is designed as a strict data interchange format. Because comments are not part of the specification, parsers reject them instead of ignoring them.

How to fix it

  1. Remove all single-line or block-style comments from the payload.
  2. If the note matters, move it into documentation or a real data field.
  3. Validate the cleaned JSON.
  4. Format it for easier inspection.

FAQ

Do any JSON parsers allow comments?

Some tools support JSON-like extensions, but standard JSON itself does not.

Can block comments break JSON too?

Yes. Both line comments and block comments are invalid in standard JSON.

What should I do with explanatory notes?

Keep them in documentation, or store them in a real JSON field if they must travel with the data.

Can I validate after removing comments?

Yes. Use the validator to confirm the cleaned payload is now valid JSON.