JSON Formatter
Format, validate, beautify, and minify your JSON instantly. Fast, private, and processed entirely in your browser.
How to format and validate JSON
Paste, upload or import JSON, format it, and read it as a tree or copy the indented text.
- 01
Get your JSON in
Paste it, upload a .json file, or use Import URL to fetch it straight from an address. Sample loads an example to try the features.
- 02
Press Format JSON, or Minify
Format re-indents valid JSON with 2 spaces and shows it as a collapsible tree. Minify strips every space and line break for the smallest output. Invalid JSON shows your browser's error message, which in Chrome and Edge includes the line and column.
- 03
Explore, copy or download
Expand and Collapse open or close the whole tree. The stats bar shows lines, bytes and keys. Copy or Download gives you the formatted or minified text.
- 04
Keep several documents open in tabs
New adds a tab, and tabs can be renamed. They're saved in your browser, so they're still there when you come back.
The errors that break JSON most often
JSON is stricter than JavaScript. Code that runs fine as a JavaScript object can fail as JSON. These are the usual reasons a paste won't format:
| Example | Problem | Fix |
|---|---|---|
| {"a": 1,} | Trailing comma after the last item | Delete the final comma |
| {'a': 'x'} | Single quotes | Use double quotes for keys and strings |
| {a: 1} | Unquoted key | Quote every key: {"a": 1} |
| {"a": “x”} | Curly quotes pasted from a document | Replace with straight " quotes |
| // comment | Comments aren't allowed in JSON | Remove them, or use JSONC-aware tools |
| {"a": NaN} or undefined | Not valid JSON values | Use null or a number |
Error wording varies by browser. Chrome reports something like "Expected double-quoted property name in JSON at position 7 (line 1 column 8)", while Safari's message is shorter and has no position. If you can't spot the problem, try another browser for a more precise pointer.
What formatting does to your data
Formatting parses the text into JavaScript values with JSON.parse, then writes it back out with JSON.stringify at 2-space indentation. Usually that's lossless, but three things can change. Numbers are normalised, so 1.10 comes back as 1.1 and 1e3 as 1000. If a key appears twice in the same object, only the last value survives.
The one that bites is large integers. JavaScript numbers are exact only up to 9,007,199,254,740,991 (2^53 − 1). A 64-bit ID such as 9007199254740993 is read as 9007199254740992, and the formatted output silently shows the wrong number. If your JSON holds IDs from systems like Twitter or a database with 64-bit keys, keep those IDs as strings, or don't rely on a browser-based formatter to preserve them.
When a formatter helps
Reading an API response
Paste the one-line response from your browser's Network tab, format it, and collapse the parts you don't need.
Checking a config file before deploying
A missing comma in package.json or a settings file stops an app from starting. Format it here first to catch the error with its position.
Comparing a couple of payloads
Open each in its own tab to switch between them. For a line-by-line comparison, use JSON Compare.
Limits worth knowing
- Indentation is fixed at 2 spaces. If your project uses 4 spaces or tabs, re-indent in your editor afterwards.
- Keys aren't sorted, and comments, trailing commas or JSON5 syntax aren't accepted.
- Import URL fetches from your browser, so it only works for addresses that allow cross-origin requests. Many APIs don't; download the file and upload it instead.
- Very large files, tens of megabytes, can make the tree view slow. The text output stays usable.