JSON Formatter

Developer Tools

Format, validate & minify JSON

FreePrivateInstant
Add a file · .txt .md .csv .json … · up to 2.00 MB
Full guide, 3 min readWhy your JSON will not parse, and how to find the bad commaRead the story behind this tool →
Embed this tool on your websiteFree
  1. Choose how tall the frame should be.
  2. Press Copy code.
  3. Paste it into your page, blog, WordPress or Notion HTML block.
Height

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 →
About this tool

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

MistakeWrongRight
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}
JSON is stricter than JavaScript. Keys and text must use double quotes, and comments are not allowed.

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.

Messy JSON
{"name":"Raj","age":25,
"city":"Delhi"}
Format
Pretty JSON
{
"name": "Raj",
"age": 25,
"city": "Delhi"
}

How to use it — step by step

You can also minify JSON to make it as small as possible.

1

Paste JSON

Paste your JSON (from an API, file or code) into the input box.

2

Choose mode

Pick Format to beautify or Minify to compress. Set indent to 2 or 4 spaces.

3

Press the button

If there is a mistake, you will see an error telling you where.

4

Copy output

Copy the clean JSON with one click.

Pro tips

Small things that make the result better.

✦All keys and strings need "double quotes" — single quotes are invalid in JSON.
✦No trailing comma after the last item.
✦Use Minify before sending JSON in production to save bandwidth.

Quick facts

2 / 4space indent options
Validatesshows syntax errors
Minifysmallest possible size
PrivateJSON stays in your browser

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

More Free Tools