99tools

JSON Formatter & Validator

runs in your browser

Beautify or minify JSON, validate it and jump straight to the first syntax error. Runs entirely in your browser.

Output
Indent

Input

Output

about this tool

What this tool does

Paste JSON and it is parsed, checked and printed back in one of three shapes. Format indents the document so it can be read, with two spaces, four spaces or tabs. Minify strips every optional space and newline, which is what you want before putting JSON in a header, a query string or a database column. Stringify wraps the whole document in a quoted string literal with the inner quotes escaped, ready to paste into source code or a shell command.

Everything happens in the page. The JSON is never sent anywhere, which matters when the thing you are debugging is a production API response or a token payload.

Reading the error

When parsing fails you get the engine's message plus a line and column. The column is recalculated from the character offset rather than scraped out of the message text, so it stays correct across browsers that word their errors differently.

The parser is strict JSON.parse, the same one your code uses. That is deliberate: if this tool accepted comments and trailing commas, it would tell you a document is fine when your application is about to reject it. So a trailing comma after the last property is an error here, and so is a // comment, a single-quoted string, an unquoted key, or NaN. If you need to clean up that kind of near-JSON, the JSON escape tool has a JavaScript-to-JSON mode that repairs it into strict JSON.

Sorting keys

Sort keys reorders every object's properties alphabetically, at every level of nesting. Two API responses that contain the same data in a different order produce identical text once sorted, which turns an unreadable diff into a short one. It changes only the order of keys — no value is touched, and arrays keep their order, because in JSON an array's order is data.

Stringify, and when you want it

Stringify is the mode people do not know they need until they are writing a test fixture or a curl command. It escapes the document into a single string literal, so:

{"id":42}   becomes   "{\"id\":42}"

By default it escapes the compact form, since the newlines of the indented form become \n and are rarely wanted inside a literal.

Size

There is no upload limit because there is no upload. The practical ceiling is your browser's memory, which for a text document is far larger than most people expect — multi-megabyte API dumps are fine. The byte count under the output is the UTF-8 size, so it matches what a server would actually send.

A GraphQL query is not JSON and will not parse here — the GraphQL formatter handles queries, mutations and schemas, and reports syntax errors by line and column.

questions

Is my JSON uploaded to a server?
No. Parsing and formatting happen in your browser, and the document never leaves your device. You can confirm it by opening the tool, disconnecting from the network and using it as normal.
Why is my JSON rejected for a trailing comma or a comment?
The tool uses strict JSON.parse, the same parser your application uses, so anything it rejects your code would reject too. Comments, trailing commas, single-quoted strings and unquoted keys are not valid JSON.
What is the difference between formatting and minifying JSON?
Formatting adds indentation and newlines so a human can read the document. Minifying removes every optional space and newline to make it as small as possible for storage or transport. Both describe exactly the same data.
Does sorting keys change my data?
No. It reorders each object’s properties alphabetically so two documents can be compared by eye, but no value is altered and arrays keep their original order, because order is meaningful in a JSON array.
How large a file can it handle?
There is no upload limit because nothing is uploaded. The practical limit is your browser’s memory, which comfortably handles multi-megabyte API responses.