JSON Formatter — Beautify, minify and validate JSON with clear error messages, right in your browser.

Paste JSON and it is checked and formatted as you type. Pick 2 spaces, 4 spaces, a tab or minified output, sort the keys if you like, and get the exact line and column when something is wrong. Your data is never uploaded.

Format my JSON Your JSON stays in your browser
JSON formatter showing messy JSON on the left and neatly indented JSON with a valid status on the right

JSON input

Output style

Result

–Status
–Top level
–Keys
–Depth
–Input size
–Output size
The guide

JSON Formatter Guide: Readable, Valid JSON

What JSON is, why it breaks and how to fix it quickly.

A simple explanation

What is a JSON Formatter?

A JSON formatter turns JSON text into a tidy, indented layout that people can read, or squeezes it into one compact line for sending. A validator checks that the text really is JSON and tells you where it is not.

This tool does both at once. It reads your JSON with a strict parser, shows the result in the style you choose and gives the line and column of any mistake, so you can fix it without hunting through the text.

Common reasons to use it

Why People Use a JSON Formatter

Reading API responses

Paste a minified response and see its structure at a glance instead of one long line.

Config files

Check package, settings and data files for typos before an app fails to load them.

Smaller payloads

Minify JSON to strip whitespace before you embed it in a page, a request or a test.

How it works

What Makes JSON Valid

JSON has a small set of rules. Text is wrapped in double quotes, including every key. Values can be strings, numbers, true, false, null, arrays or objects. Items are separated by commas, with no comma after the last one, and comments are not allowed.

Most errors come from a few habits carried over from JavaScript or other formats: single quotes, unquoted keys, trailing commas, comments and values such as undefined or NaN. The validator names the problem it finds and the line and column where it happens.

Formatting here is careful about your data. Numbers and strings are copied exactly as written, so a long ID like 12345678901234567890 does not lose digits and 1.0 does not turn into 1. Only whitespace changes, plus key order if you turn on Sort keys. If the same key appears twice in one object, the tool warns you, because most parsers keep only the last value.

Get it done in a few steps

How to Use the JSON Formatter

  1. Paste your JSON into the input box, or open a .json file from your device.
  2. Choose 2 spaces, 4 spaces, Tab or Minify, and turn on Sort keys if you want alphabetical keys.
  3. If an error appears, press Go to the error to jump to the exact spot in the input and fix it.
  4. Press Copy, or download the result as a .json file.
Better results

Simple Tips

  • Fix the first error first. A single missing quote can cause several messages further down.
  • Use Sort keys before you compare two JSON files, so the order does not create false differences.
  • Keep the formatted version while you work and minify only when you are ready to ship.
  • If your data uses comments or trailing commas on purpose, it is JSON5 or JSONC. Remove them before sending it to a standard JSON parser.
Good to know

Limitations and Privacy

Privacy

Your JSON is parsed and formatted in your browser by JavaScript on this page. It is not uploaded, stored or logged, and downloaded files are created on your device.

Limitations

Only standard JSON is accepted. Comments, trailing commas, single quotes and NaN are reported as errors, and the tool does not repair them for you. Very large files, over about 10 MB, are not processed.

Common questions

JSON Formatter FAQ

How do I format JSON?

Paste your JSON into the input box. It is formatted straight away with the indentation you pick: 2 spaces, 4 spaces or a tab. Then copy the result or download it as a .json file.

How does the JSON validator find errors?

The tool reads your text with a strict JSON parser. If something is wrong, it shows the line and column of the problem with a short explanation, and a button takes you to that spot in the input.

What is the difference between beautify and minify?

Beautify adds line breaks and indentation so JSON is easy to read. Minify removes all optional whitespace to make the text as small as possible. The data is the same either way.

Why does my JSON show an error?

The usual causes are a trailing comma, single quotes instead of double quotes, keys without quotes, a missing comma between items, or comments. Standard JSON allows none of these, and the error message points to the exact place.

Does formatting change my data?

No. Strings and numbers are kept exactly as you wrote them, including very large numbers and values like 1.0 or 1e3. Only whitespace changes, plus the order of keys if you turn on Sort keys.

Can JSON have comments or trailing commas?

Not in standard JSON. Formats such as JSON5 and JSONC allow them, but this validator follows the standard, so it reports comments and trailing commas as errors.

Is my JSON uploaded anywhere?

No. Formatting and validation run in your browser, and your JSON never leaves your device. That makes it safe for API responses and config files that you would rather keep private.

How large a JSON file can I format?

Up to about 10 MB of text. Speed depends on your device, so very large files can take a moment on a phone. Everything is processed in your browser memory.

From people using this tool

Reviews

Loading reviews…
Keep going

More tools in the box

The homepage features dozens more free tools that don't require an API key.

Suggest a tool