JSON5 / JSONC Formatter & Validator

Last updated:

Paste JSON5 or JSONC (VS Code settings.json, tsconfig.json), pretty-print it with comments kept, or minify it to strict JSON. All in your browser, nothing uploaded.

How it works

  • This tool uses Format / Minify — the same pairing as this site’s plain JSON Formatter, not “To JSON” like the other formatters here — because JSON5/JSONC already more or less is JSON. There’s no second format to convert to.
  • Format pretty-prints while keeping every comment exactly where it was — on its own line before an entry, or trailing a value on the same line — and always adds a trailing comma on a multi-line object or array (modern JSON5/JSONC style). Its output is valid JSON5/JSONC, not necessarily strict JSON.
  • Minify strips every comment and trailing comma, producing compact output any standard JSON.parse can read — “compile this down to real JSON.”
  • Accepts // and /* */ comments, trailing commas, unquoted object keys, single-quoted strings, and the extra JSON5 number forms: hex (0x1F), a leading or trailing decimal point (.5, 5.), a leading +, and Infinity/NaN. Format always double-quotes strings and keys on output, even when the source used single quotes or left a key unquoted.

Strict JSON has no way to represent Infinity/-Infinity/NaN — rather than silently turning one into null the way JSON.stringify does, Minify refuses with a named error if the document contains one. Format keeps them as literal tokens, since Format’s output doesn’t promise strict-JSON compatibility in the first place.

Runs entirely in your browser — nothing you paste here is uploaded, logged, or stored.

🔧 Also try: JSON Formatter →