JSON Formatter & Validator
Format, validate and minify JSON with exact error positions, a collapsible tree, optional key sorting and one-click copy or download — parsed entirely in your browser, so tokens and secrets in payloads stay on your device.
Reviewed 17 November 2026 · Free · No account needed
How to use
- Paste JSON, drop a .json file, or press Sample to load a working document.
- Pick an indent (2 spaces, 4 spaces or a tab) and press Format — or Minify to strip every byte of whitespace.
- Invalid JSON shows the parser's own message, the line and column, and a Jump to error button that selects the exact character.
- Switch to Tree view to fold large documents, filter keys and values, and click any key to copy its JSON path ($.items[0].id).
- Copy the result or download it as formatted.json — nothing is uploaded at any step.
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
- The live editor is capped at 5 MB of text; the tree view renders up to 20,000 nodes and asks you to use Text view above that.
- Accepts exactly what JSON.parse accepts: no comments, no trailing commas, no single quotes.
- Duplicate keys keep the last value (standard parser behaviour); key sorting is optional and off by default.
- Numbers longer than 15 digits lose precision in JavaScript, so the editor warns about them instead of silently rounding.
Privacy
Parsing and formatting happen locally in your browser. Payloads — including any tokens they contain — are never sent to a server.
Guides that use JSON Formatter & Validator
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.