JSON formatter and validator

This tool takes JSON that arrived as one unreadable line — an API response, a log entry, a config value — and lays it out with indentation so you can actually read it. It also does the reverse: minifying formatted JSON back down for a request body or an environment variable. When the text is not valid JSON it says what is wrong and where, which is usually faster than staring at a wall of brackets. It matters that this runs locally: API responses routinely contain tokens, customer records and internal identifiers, and pasting those into a website that posts them to a server is a real leak. Here the parsing happens in your browser.

How to format JSON

  1. Paste your JSON into the box, or drop a .json file onto it.
  2. Choose an indentation width — two spaces, four spaces or tabs — to match the conventions of the project you are working in.
  3. Press Format to lay the document out, or Minify to strip every space and newline back out of it.
  4. If the text is invalid, the error appears with the line and column of the character that broke the parse. Fix it and format again, then copy the result or download it as a file.

Questions about the JSON formatter

Is the data I paste sent anywhere?

No. The text is parsed by your browser's own JSON engine inside the page. Nothing is logged, stored or transmitted, which is why this is a safe place to inspect a response that contains tokens or personal data.

Why does my JSON fail to parse?

The usual causes are a trailing comma after the last item, single quotes instead of double quotes, unquoted keys, or a comment — all of which JavaScript accepts and JSON does not. The error message points at the exact character where the parse stopped.

Can it sort the keys?

Yes. Turn on key sorting to output every object with its keys in alphabetical order, which makes two versions of the same document easy to compare line by line.

Does formatting change my data?

Only its whitespace and, if you ask for it, the order of object keys — neither of which carries meaning in JSON. Values are untouched, with one caveat: numbers too large for JavaScript to hold exactly, such as 64-bit identifiers, can lose precision, so treat those as strings.

How large a document can it handle?

Files of a few megabytes format almost instantly. Very large documents — tens of megabytes — can briefly freeze the tab while the browser parses and re-renders them, since the work happens on your machine rather than on a server.

Other tools

Languages