Back to Developer
JSON5 formatter — parse JSON5 (comments, trailing commas) and emit JSON5 or strict JSON

JSON5 formatter — parse JSON5 (comments, trailing commas) and emit JSON5 or strict JSON

Parse JSON5 — the JSON superset that allows comments, trailing commas, single quotes, and unquoted keys — and emit either pretty-printed JSON5 or strict standard JSON. Great for tsconfig.json, Cargo-like commented config files, or any human-edited JSON variant. Choose 2-space / 4-space / Tab indent and get line:column parse-error markers. Runs entirely in your browser.

developerJSONformatconversion

How to use

Paste JSON5 (the JSON superset that allows comments, trailing commas, unquoted keys and single-quoted strings) and pick an output mode. Pretty JSON5 re-emits the value as JSON5 with the indent style you choose; Strict JSON converts to RFC 8259 JSON (drops comments, double-quotes keys). Pick 2-space / 4-space / Tab indent. Parse errors surface a line:column hint. Useful for converting human-edited config files like tsconfig.json into machine-strict JSON for CI.

FAQ

What does JSON5 add over JSON?
Five main extensions: (1) comments — // and /* */; (2) trailing commas in objects and arrays; (3) unquoted keys; (4) single-quoted strings; (5) extended number literals like 0xFF, .5, 5., Infinity, NaN. JSON5 is common for tsconfig.json, Babel config, Cargo-style commented configs, etc.
Are comments preserved on output?
No. The tool parses with json5.parse and re-emits with json5.stringify, both of which discard comments. For comment-preserving formatting reach for Prettier or similar.
How is this different from json-format?
json-format only handles strict JSON — anything with a comment or trailing comma fails to parse. Use json5-format as the front door for tsconfig-style files, then optionally convert to strict JSON for CI consumption.
How are strings quoted on output?
Pretty JSON5 mode uses single quotes when convenient (json5.stringify's default); Strict JSON mode always emits double quotes.
Are JSON5 number extensions supported?
Yes — anything json5 understands: 0xFF (hex), .5 (leading dot), 5. (trailing dot), Infinity / NaN / +0 / -0. Strict-JSON output collapses them to standard decimal representations where possible.
Is my input uploaded?
No. Parsing and formatting run entirely in your browser, so the JSON5 content never leaves the device.

Related tools