JSON formatter
Paste JSON, get it pretty or minified. Ctrl+C copies the result.
How to format JSON
Paste or open
Paste JSON into the Input pane, press Open to pick a .json file, or drop a file onto the pane. Sample loads a small example to try the options on.
Choose a mode
Beautify indents with 2 spaces, 4 spaces or tabs. Minify strips every space and line break outside strings. Tick Sort keys to order keys alphabetically at every level. The output updates as you type.
Copy or download
Press Copy on the Output pane, or Ctrl+C (Cmd+C on Mac) with nothing selected to copy the whole result. Download saves data.json, or data.min.json when minified.
Good to know
- Not strict JSON? The tool repairs JavaScript-style input: unquoted keys, single-quoted strings, trailing commas and comments. undefined and NaN become null.
- Invalid JSON shows the line and column of the first problem, and Go to error selects that spot in the editor.
- Files up to 2 MB open in the editor. Larger files stay out of it: you see the first 64 KB while a background worker reads the whole file, so hundreds of megabytes work without freezing the page.
- Only the first 1 MB of the result is drawn on screen. Copy and Download always use the full output. Above 20 MB the Copy button is disabled; use Download instead.
- Parsing uses the browser's JSON engine, so integers above 2^53 (about 9 quadrillion) lose precision. Keep such IDs as strings.
- Everything runs in your browser. Nothing is uploaded.
Questions people ask
Why does it say my JSON is invalid?
Strict JSON needs double-quoted keys and strings, no trailing commas and no comments. The tool repairs those on its own; if it still fails, the error names the line and column and Go to error jumps there. The usual leftovers are a missing comma between items or a stray quote.
Can I format a very large file?
Yes. Files over 2 MB are not loaded into the editor; a background worker reads them straight from disk, so the page stays responsive. The result pane shows the first 1 MB and Download gives you the whole output.
Does Sort keys change the data?
No. Every value stays the same; only the order of keys changes, alphabetically at every nesting level. Arrays keep their order.
What is the difference between Beautify and Minify?
Beautify adds line breaks and indentation so the JSON is easy to read. Minify removes all whitespace outside strings to make the smallest payload. Both parse the input first, so both catch errors.
Is my data uploaded?
No. Parsing and formatting run in a web worker inside your browser. Nothing is sent to a server.