JSON Formatter
Paste your JSON below to format, validate and minify it instantly. If something's wrong, you'll get the exact line and column rather than a vague error. Everything runs in your browser — your data is never uploaded.
Runs entirely in your browser — your JSON is never uploaded or stored.
Paste JSON on the left to see the formatted result here.Output options
What this tool does
Format takes compressed or messy JSON and lays it out with consistent indentation, so nested structures are readable. Minify does the reverse, stripping every unnecessary space and line break to make the payload as small as possible — useful before sending JSON over a network or embedding it in a config.
Validation runs as you type. Valid JSON gets a confirmation; invalid JSON gets an error with the line and column where parsing failed, plus a plain-language explanation of what's likely wrong.
You can choose 2 spaces, 4 spaces, or tabs for indentation, depending on your project's conventions.
Common JSON errors and what they mean
Most JSON that fails to parse trips over one of a handful of mistakes.
- Trailing commas. JavaScript tolerates
{"a": 1,}but JSON does not. A comma after the last item in an object or array is invalid, and it's the single most common cause of parse failures. - Single quotes instead of double. JSON requires double quotes for both keys and string values.
{'name': 'value'}is valid JavaScript but invalid JSON. - Unquoted keys.
{name: "value"}is a JavaScript object literal, not JSON. Every key must be a quoted string. - Comments. JSON has no comment syntax.
//and/* */will both cause a parse error, which surprises people editing config files that look JSON-like but aren't (such as.jsoncor JSON5 files, which do allow comments). - Unescaped characters in strings. Literal newlines, tabs, or unescaped double quotes inside a string break parsing. They need escaping as
\n,\t, and\". - Missing or mismatched brackets. Usually reported at the end of the document rather than where the problem started, which is why a line number for the failure point helps more than the raw message.
- NaN, Infinity, or undefined. None of these are valid JSON values. Only strings, numbers, booleans, null, objects, and arrays are allowed.
Is it safe to paste sensitive JSON here?
Yes — nothing you paste leaves your device. This formatter runs entirely as JavaScript in your own browser. There is no server call, no upload, and nothing is stored.
This matters because developers regularly need to format API responses, configuration files, or payloads that may contain keys, tokens, or personal data. Many online formatters send your input to a server to process it, which means pasting a production API response into one is effectively handing that data to a third party. This tool doesn't do that. If you want to confirm it, open your browser's network tab while using it — you'll see no requests carrying your JSON.
That said, general good practice still applies: avoid pasting live production secrets into any web page, here or anywhere else, and rotate anything you think may have been exposed.
JSON formatting conventions
There's no single official style, but a few conventions are widespread. Two-space indentation is the most common default in JavaScript and web projects, and it's what most linters and formatters produce. Four spaces is more common in Python-adjacent and some enterprise codebases. Tabs are less common in JSON specifically but are used where a project standardises on tabs throughout.
Minified JSON is standard for anything sent over a network, since whitespace is pure overhead. Formatted JSON is for humans — reading, reviewing, and committing to version control, where consistent indentation makes diffs far easier to follow.
Frequently asked questions
- Is my JSON sent to a server?
- No. The tool runs entirely in your browser. Nothing you paste is uploaded, logged, or stored anywhere.
- How large a file can I format?
- There's no hard limit, but there are practical ones. Past about 200,000 characters, live formatting pauses and you'll need to click Format or Minify manually — very large or deeply nested JSON can also take a moment, since everything runs in your browser rather than on a server.
- Why does my JSON fail when it looks correct?
- The most common causes are a trailing comma, single quotes instead of double quotes, an unquoted key, or a comment. The error message will point you to the line and column.
- Does it support JSON5 or JSONC?
- No, it validates strict JSON as defined by the specification. Files that allow comments or trailing commas are different formats and will be reported as invalid here.
- What's the difference between formatting and minifying?
- Formatting adds indentation and line breaks to make JSON readable. Minifying removes all unnecessary whitespace to make it as small as possible. Both produce identical data.
- Is it free?
- Yes, completely free with no sign-up.