JSON Formatter and Validator

Format, minify, validate and repair JSON with exact error positions, a searchable tree view and key sorting. Also decodes JWTs, base64 and URL encoding.

Indent
Output

Nothing to format yet

Paste JSON on the left, drop a file onto it, or use Open file.

Related tools

What it does

A JSON workbench: paste or drop a document and it is formatted, minified or validated as you type, with the result shown as highlighted code or as a collapsible tree you can search. When the JSON is broken, the error names the exact line and column, shows the offending line with a caret under the problem, and says what is wrong in plain words (a trailing comma, single quotes, an unquoted key, a bracket that was never closed) instead of an engine message. Repair fixes the common kinds of almost-JSON in one click, including comments, Python True and None, curly quotes and truncated documents, and lists every change it made. The same box also decodes a JWT, converts base64 and URL encoding, and escapes or unescapes a JSON string.

How to use it

Paste JSON into the input, drop a file on it, or use Open file. Pick Format or Minify, choose 2 spaces, 4 spaces or tabs, and turn on Sort keys if you want every object in alphabetical order. Switch the output to Tree to collapse and expand nodes, search keys and values, and copy any value or its JSONPath. If the document has an error, press Go to error to jump to it in the input, or Repair to fix it. Copy the result or download it as a .json file; press Ctrl+Enter to replace the input with the formatted output.

Why this one

Most JSON formatter sites report "Unexpected token" with no position, choke on a large file, and wrap the page in ads; several send what you paste to a server. A JSON payload or a JWT often holds live credentials, so that is a real leak. Here everything runs in your browser and your files and inputs never leave your device. There is no size cap, a multi megabyte document stays responsive because only the rows on screen are drawn, and the page keeps working offline after the first load.

FAQ
How do I find the error in invalid JSON?
Paste it in. The error panel shows the line and column, the offending line with a caret under the exact character, and a plain explanation such as a trailing comma before a closing brace or a missing comma between two values. Go to error selects that character in the input. If the problem is one of the common ones, Repair fixes it and tells you what it changed.
What can Repair fix, and is it safe?
It handles trailing, doubled and missing commas, single quoted or curly quoted strings, unquoted keys, comments, Python and JavaScript literals such as True, None, undefined and NaN, numbers like .5 or 0x1F, raw line breaks inside strings, Markdown code fences, several documents in a row, and brackets left unclosed by a cut off copy. It reads the text into a value and writes that value back out, so the result is always valid JSON, and it lists every change with a count and offers Undo. It is a best guess at what you meant, so check the list before you rely on the result.
Is it safe to paste a real JWT or API response here?
The formatting and decoding happen entirely in your browser and nothing is uploaded, so it is far safer than a server side tool. A JWT is still a live credential, so treat the screen you paste it on with the same care as a password. JWT mode decodes the header and payload and labels the signature as unverified: checking a signature needs the secret or public key, which should not be pasted into a web page.

Keyboard shortcuts: press ? anywhere on this page to see them.