JSON format guide

JSONC: JSON with Comments

JSONC commonly means “JSON with Comments.” It is used by tools and configuration systems that want JSON-like syntax with comments, and some implementations also allow trailing commas. JSONC is not interchangeable with strict JSON unless the parser explicitly supports it.

Quick answer

A file can be valid JSONC and invalid JSON. Remove comments and any unsupported relaxed syntax before sending JSONC content to a strict JSON parser or API.

Where JSONC appears

Developer tooling frequently uses JSONC for editable settings because comments make configuration easier to document. The exact accepted syntax depends on the parser, so JSONC should be treated as a parser-specific format rather than assumed universal JSON.

Comments break strict JSON

The JSON grammar has no // or /* */ comment syntax. A strict parser encounters the slash as an unexpected token. This is why copying settings files directly into an API body often fails.

Do not remove comments with a naive regex

Comment markers can appear inside quoted strings and URLs. A parser-aware transformation is safer than globally deleting text after // or between /* and */.

Typical JSONC configuration

{
  // Editor preference
  "theme": "dark",
  "autosave": true
}

Related JSON tools and guides

Frequently asked questions

Is JSONC valid JSON?

Not when it contains comments or other syntax that strict JSON does not allow.

Does JSONC always allow trailing commas?

That depends on the parser. Check the tool or library specification.

Can browsers parse JSONC with JSON.parse?

No. JSON.parse expects strict JSON.

Source-backed reference

JSON standards quick reference

Concise, standards-backed facts for developers working with JSON debugging and validation. Each claim is linked to the evidence registry and resolves to a primary standard or platform reference so it can be independently verified.

JSON standard
JSON is a text format for serializing structured data, with syntax defined by interoperable standards rather than by FixTools.
Strings and object keys
JSON strings and object member names use double quotation marks. Single-quoted strings are not valid standard JSON syntax.
Trailing commas
Standard JSON grammar does not allow a comma after the final member of an object or the final element of an array.
Parser behavior
JSON.parse() parses JSON text into a JavaScript value and raises a SyntaxError when the input is not valid JSON.

Common invalid → valid JSON examples

Trailing comma

{"a":1,}{"a":1}

Single-quoted key

{'a':1}{"a":1}

Unsupported literal

{"score":NaN}{"score":null}

Built for verification, not just extraction

Direct answers are paired with source-specific evidence. This keeps technical claims independently verifiable and gives search and answer systems a clearer provenance trail than unsupported summary copy.