JSON vs JSON5 vs JSONC: What's the Difference?

JSON has spawned relaxed variants that fix its biggest annoyances for human-edited files. The three you'll meet are plain JSON, JSONC, and JSON5.

Plain JSON

The strict standard. No comments, no trailing commas, double-quoted keys and strings only. Universally supported. Use it for data interchange and anything a machine reads or writes.

JSONC (JSON with Comments)

JSON plus // and block comments — essentially the only addition. Popularized by VS Code for settings.json and tsconfig.json:

{
  // a single-line comment
  "port": 8080
}

Use it for config files in tools that explicitly support it. Plain parsers reject it.

JSON5

The most relaxed. Adds comments, trailing commas, unquoted keys, single quotes, and more:

{
  port: 8080,        // unquoted key, comment
  host: 'localhost', // single quotes
  tags: ['a', 'b',], // trailing comma
}

Use it for human-authored config where you control the parser.

Comparison

FeatureJSONJSONCJSON5
CommentsNoYesYes
Trailing commasNoNoYes
Unquoted keysNoNoYes
Single quotesNoNoYes
Universal parser supportYesNoNo

Which should you use?

  • Sending or storing data? Plain JSON.
  • Config in a tool that supports comments? JSONC.
  • Hand-writing rich config you control? JSON5.
  • Want comments and clean nesting without a JS superset? Consider YAML or TOML.

Convert to strict JSON

Need a relaxed file turned into portable JSON? Paste it into the validator to spot the non-standard bits, then clean and format it with the formatter.

Got a config file to check?

Open the config toolkit →