JSON Formatter (2026)
Format, pretty-print, and minify JSON in your browser — instantly, with no signup. Catch syntax errors with precise pointer messages and copy clean output in one click. Runs entirely client-side; your data never leaves the page.
{
"name": "Specway",
"tags": [
"api",
"openapi"
],
"version": 1,
"active": true,
"meta": {
"createdAt": "2026-01-01"
}
}What this tool does
Paste JSON in the left pane. The formatter parses it with the browser's native JSON.parse and re-serializes either pretty-printed (2-space, 4-space, or tab indent) or minified (no whitespace). The output appears live as you type.
If parsing fails, the right pane shows the exact error from the JSON parser — usually a position marker like "Unexpected token } in JSON at position 42" — so you can jump straight to the offending byte.
Privacy: the entire pipeline runs in your browser. No network request leaves your device. Safe for API responses, JWT payloads, internal config — anything you don't want uploaded.
When to pretty-print vs minify
Pretty-printed JSON is for humans — code review, debugging an API response, walking a colleague through a config file. The whitespace and line breaks make structure readable at a glance.
Minified JSON is for machines — API responses, websocket messages, anywhere bytes-on-the -wire matter. A typical pretty-printed payload is 30–60% larger than its minified equivalent. Over a million API calls a day, that's real bandwidth.
Both produce identical parsed objects — pretty-print is purely formatting. Always store and transmit minified; pretty-print only when reading.
Common JSON errors and how to fix them
- Trailing commas: JSON forbids
,after the last item in an array or object. JavaScript allows it, which trips people up. - Single quotes: JSON strings must use double quotes.
{name: "x"}and{'name': 'x'}both fail. - Unquoted keys: object keys must be strings.
{name: "x"}needs to be{"name": "x"}. - Comments: standard JSON disallows
//and/* */. Use JSON5 or JSONC if you need them. - Unescaped newlines: a literal newline inside a string fails. Use
\\ninstead. - Undefined / NaN / Infinity: JSON doesn't support these JavaScript values. Use
nullfor missing, or stringify the number.
Why this matters for API documentation
Most API integration bugs trace back to malformed JSON — a trailing comma in an example payload, a quotes-vs-quotes mismatch, an unescaped value the dev pasted from a database. Catching those at the request-formation stage is hours faster than chasing a 400 from the API.
If you publish API docs, every example payload is a candidate for malformation. Specway auto-validates examples against your OpenAPI schema at build time and refuses to ship docs with broken JSON. That's why our formatter is here — same standard, same tooling.