JSON Formatter / Validator
Beautify, minify and validate JSON instantly in your browser
About this tool
This JSON formatter beautifies, minifies, and validates JSON entirely in your browser, with nothing uploaded to a server. Paste a messy API response or a hand-written config and get clean, indented output you can read; or minify it back to a single line to save bytes. If the text is not valid JSON, the tool points at the line and column where parsing failed so you can fix the problem fast. It uses the browser's own JSON.parse and JSON.stringify, so the result matches exactly what your code will see.
How to use
- 1 Paste or type your JSON into the input box.
- 2 Choose Beautify to indent it, or Minify to collapse it to one line.
- 3 When beautifying, pick 2 or 4 spaces of indentation.
- 4 Copy the formatted output, or read the error message if the JSON is invalid.
How it works
The tool calls JSON.parse to turn your text into a JavaScript value. If parsing succeeds, the data is rebuilt with JSON.stringify: passing an indent of 2 or 4 produces readable, pretty-printed output, while passing no indent produces compact, minified output with no extra whitespace. Beautifying never changes the data itself — only the spacing and line breaks — so {"a":1,"b":[2,3]} and its indented form are exactly equal. If JSON.parse throws, the error message often includes a character position, which the tool converts into a 1-based line and column to help you locate the mistake.
Frequently asked questions
What is the difference between beautify and minify?
Beautify adds indentation and line breaks so JSON is easy to read. Minify strips all unnecessary whitespace so the JSON is as small as possible for transport. Both keep the data identical.
Why does it say my JSON is invalid?
Common causes are trailing commas, single quotes instead of double quotes, unquoted keys, or comments — none of which strict JSON allows. The error message and the line and column shown point you to where parsing stopped.
Is my data uploaded anywhere?
No. All parsing and formatting happens locally in your browser using JavaScript, so your JSON never leaves your device.
Does formatting change the order of my keys?
No. JSON.stringify preserves the insertion order of object keys, so the structure and ordering you paste in are kept in the output.
Related tools and uses
To encode text for transport, see the Base64 encoder and URL encoder. To verify file integrity or compare values, use the hash generator. For inspecting raw characters, try the ASCII / Unicode converter.