How do I format or validate JSON?
Paste JSON and the tool pretty-prints it with the indentation you choose, or minifies it, and reports the exact position of the first syntax error if there is one. Parsing uses JavaScript’s own JSON parser, so the output is valid by construction.
Runs entirely in your browser · no upload · no account · no watermark
- Paste JSON into the left box.
- Choose an indent, or use Minify for a single line.
- Copy the result, or fix the error the tool points to.
What this page can do
- Pretty-print with 2, 4 or tab indentation
- Minify to a single line
- Reports line and column of the first syntax error
- Sort keys, and optionally escape non-ASCII
When to use this page
- Reading a minified API response or a one-line config file.
- Finding a bracket or comma error before you paste JSON somewhere else.
- Minifying JSON for a request body.
When to use something else
- The payload is tens of megabytes — it is parsed entirely in memory on the main thread.
- You need JSON5, comments, trailing commas or schema validation.
- You need jq-style queries, diffs or transformations.
How it compares with other options
Editors, jq and CLI validators stream large files, validate against a schema, keep comments, and explain errors with precise source spans. This page calls the browser’s JSON.parse and reports what the engine reports, which is not always the exact character that started the problem. It is a quick way to make one response readable, not a JSON workbench.
Where your files go
Nowhere. This page loads the code that does the work, and from then on the file you open is read by your own browser. There is no upload step, no temporary server copy and no cleanup to trust — the data never crosses the network, so there is nothing to delete afterwards. You can confirm it yourself: open your browser’s network panel while the tool runs and watch it stay quiet.
Questions about this tool
- Why does the parser reject JSON that works in my code?
- JSON is a stricter subset of JavaScript. It does not allow comments, trailing commas, single-quoted strings, unquoted keys, or the values NaN and Infinity. If you pasted a JavaScript object literal, quote the keys, delete the comments and remove the trailing comma — the tool tells you which line the first problem is on so you are not hunting through the file.
- Does sorting the keys change my data?
- No, only the order in which object keys are written. Values are untouched, and arrays keep their original order because their order is meaningful. Sorting is useful when you want two JSON documents to diff cleanly regardless of how each was produced.
- Is the JSON I paste sent anywhere?
- No. Parsing and formatting use the JavaScript engine already running in this page, and the text never leaves the tab. You can open the developer tools network panel and watch it stay empty while you format.
Other tools in the same group
- QR code generatorTurn any text or URL into a downloadable PNG or SVG QR code.
- Hash generatorSHA-1, SHA-256, SHA-384 and SHA-512 digests of text or a file, computed locally.
- Base64 encoderEncode text or a file to Base64 and decode it back, including URL-safe variants.
- Regex testerTry a JavaScript regular expression against sample text, with matches and capture groups.