JSON Formatter & Validator
Format, validate and minify JSON with precise error messages — parsed entirely in your browser, so tokens and secrets in payloads stay on your device.
How to use
- Paste JSON into the input box.
- Click Format (2 or 4 spaces) or Minify; errors show the exact message from the parser.
- Use Copy to place the result on your clipboard, or Sample to load a valid example.
Example
Input: {"a":1,"b":[2,3]}
Output: { "a": 1, "b": [ 2, 3 ] }
How it works
The input is parsed as JSON and re-printed with indentation, so nested objects and arrays become readable. If parsing fails, the exact error position is reported instead of a formatted result.
Parse with JSON.parse, then re-print with JSON.stringify(value, null, indent) — indent 2 or 4 spaces, or no indent for minified output.
{"a":1,"b":[2,3]} formatted with 2 spaces becomes a multi-line object with "b" as an indented array.
Edge cases to know
- Only strict JSON is accepted: no comments, no trailing commas, no single quotes.
- Keys are not re-ordered; duplicate keys keep the last value.
- Multi-megabyte payloads may be slow on low-memory devices.
Limits & compatibility
- Accepts exactly what JSON.parse accepts: no comments, no trailing commas, no single quotes.
- Keys are not re-ordered; duplicate keys keep the last value (standard parser behaviour).
- Multi-megabyte payloads may be slow on low-memory devices.
Privacy
Parsing happens locally in your browser. Payloads — including any tokens they contain — are never sent to a server.
Related tools
Questions about JSON Formatter & Validator
What does formatting do to my JSON?
It parses the input and re-prints it with indentation — 2 spaces, 4 spaces, or fully minified — so nested objects and arrays become readable. The data itself is unchanged and keys are not re-ordered.
Why does it say my JSON is invalid?
It accepts exactly what JSON.parse accepts: no comments, no trailing commas and no single-quoted strings. When parsing fails, the exact error and its position are reported instead of a formatted result.
Does formatting change my data?
No. Formatting only changes whitespace. One parser behaviour to know: if your input has duplicate keys, the last value wins — that is standard JSON.parse behaviour, not something this tool adds.
Can I paste a very large JSON file?
Yes — everything is parsed in your browser and nothing is uploaded. Multi-megabyte payloads may be slow on low-memory devices, so for very large files a smaller chunk formats faster.