JSON Formatter
Developer ToolsFormat, validate & minify JSON
Embed this tool on your websiteFree
- Choose how tall the frame should be.
- Press Copy code.
- Paste it into your page, blog, WordPress or Notion HTML block.
The tool runs inside your visitor's browser, nothing is uploaded, and a small "Powered by ToolCloak" line stays under it. The second line (script) is optional: it makes the frame fit the tool's height.
Similar tools you may like
History
All history →JSON formatter: pretty-print, minify and fix the errors that break JSON
JSON from an API often arrives as one long line that is impossible to read. The formatter indents it, or shrinks it again, and tells you when the JSON is invalid. This page explains both modes and the mistakes behind most “Syntax Error” messages.
What the tool does
- Format: rebuilds the JSON with line breaks and indentation, using 2 or 4 spaces.
- Minify: removes all extra spaces and line breaks to make the smallest valid text.
- Validation: if the text is not valid JSON, you get a Syntax Error message instead of output.
You can load a sample, then copy the result. It does not repair invalid JSON for you. You have to fix the error and run it again.
The usual reasons JSON is invalid
| Mistake | Wrong | Right |
|---|---|---|
| Trailing comma | {"a": 1,} | {"a": 1} |
| Single quotes | {'a': 1} | {"a": 1} |
| Unquoted key | {a: 1} | {"a": 1} |
| Comment | {"a": 1} // note | {"a": 1} |
| Missing comma | {"a": 1 "b": 2} | {"a": 1, "b": 2} |
| undefined or NaN | {"a": undefined} | {"a": null} |
Things to know about the output
- Key order: the order is kept, except that keys that are whole numbers, like "1" and "2", are placed first in ascending order. This is how JavaScript handles objects.
- Duplicate keys: if a key appears twice, only the last value survives.
- Big numbers: numbers beyond about 15 or 16 digits, such as 12345678901234567890, lose precision. Keep IDs like that as strings.
- Escapes: sequences like \u0041 are shown as the real character in the output.
Format or minify?
Use format when reading, debugging or sharing in a chat or ticket. Use minify before sending JSON over a network or storing it in a config where size matters. Minifying does not change the meaning, only the whitespace.
Privacy
Your JSON is processed in your browser and is not uploaded. Even so, do not paste real passwords or secret keys into any online tool.
JSON Formatter — at a glance
Turn messy one-line JSON into neat, indented, easy-to-read JSON — and check it for errors.
How to use it — step by step
You can also minify JSON to make it as small as possible.
Paste JSON
Paste your JSON (from an API, file or code) into the input box.
Choose mode
Pick Format to beautify or Minify to compress. Set indent to 2 or 4 spaces.
Press the button
If there is a mistake, you will see an error telling you where.
Copy output
Copy the clean JSON with one click.
Pro tips
Small things that make the result better.
Quick facts
Frequently Asked Questions
What is JSON Formatter?+
Format, validate, minify, and beautify JSON with syntax error detection. Tree view with collapsible nodes, configurable indent levels, and instant minification for production use.
How do I use JSON Formatter?+
Open JSON Formatter on this page, then: 1. Paste JSON 2. Choose mode 3. Press the button 4. Copy output. Everything runs in your browser on a phone or computer.
Is JSON Formatter free to use?+
Yes. JSON Formatter on Toolcloak is free, needs no signup and has no hidden limits.
Why does my JSON show a syntax error?+
Common causes: a trailing comma, single quotes instead of double quotes, a missing comma between items, or an unclosed bracket.
Format vs Minify — what is the difference?+
Format adds spaces and line breaks so humans can read it. Minify removes them to make the file smaller.
Can JSON have comments?+
No. Standard JSON does not allow comments.
Is my data safe?+
Yes. Everything runs inside your own browser. Your text, files and images are never uploaded to any server.
Also searched as: json formatter · json beautifier · json validator · json pretty print · format json online · json viewer

