Skip to content
FlipConverto home

JSON Formatter

A JSON formatter, or JSON beautifier: format JSON with two or four spaces or tabs, or minify it to one line — with the exact line and column when it will not parse.

Loading JSON Formatter…

Runs entirely in your browser. What you enter stays on your device — nothing is sent to a server. Verify it yourself

Why will my JSON not parse?

Almost always a trailing comma, single quotes instead of double, an unquoted key, or a comment — all legal in JavaScript and none of them valid JSON. The error panel above shows the exact line and column with a caret under the offending character.

Cost
Free, no limits
Upload
None — runs on your device
Sign-up
Not required
Works offline
Yes, once loaded

How to format and minify JSON

  1. Paste your JSON

    Paste into the editor. Parsing happens in your browser — useful, because JSON pasted into a formatter is often an API response containing tokens or customer data.

  2. Fix any errors

    If it will not parse, the error panel gives the exact line, column and cause, with a caret under the offending character.

  3. Format or minify

    Format with 2 spaces, 4 spaces or tabs for reading; minify to strip every byte of whitespace for transmission.

  4. Copy the result

    Copy the output. Formatting re-serialises the document, so duplicate keys collapse to the last one and 1.0 comes back as 1.

Examples

  • A minified API responseReadable, indented JSON

    The usual reason to reach for this tool.

  • Formatted JSON for a config fileA minified single line

    Smaller for transport, unreadable for humans.

Key features of the JSON Formatter

  • Pretty-prints JSON with consistent indentation
  • Minifies back down to a single line
  • Reports the position of a syntax error rather than just failing
  • Runs in the page — your data is not uploaded

Supported options

Indentation

  • 2 spaces
  • 4 spaces
  • Tab

Actions

  • Format
  • Minify

Accepts

  • Standard JSON (RFC 8259)

When should you use this?

  • Reading an API response that arrived minified.
  • Checking that generated JSON is valid before committing it.
  • Shrinking a configuration blob for an environment variable.
  • Finding the syntax error in a file something else rejected.

Limitations

  • This is strict JSON, as the specification defines it. Trailing commas, comments, single-quoted strings and unquoted keys are all errors here even though JavaScript accepts them.
  • Very large documents are bounded by browser memory, since parsing happens on your device.
  • Key order is preserved as written, but JSON itself defines objects as unordered — do not rely on the order surviving other tools.
  • Numbers are parsed as JavaScript numbers, so integers beyond 2^53 lose precision. This affects large IDs in particular.

Troubleshooting

It reports an error at the very end of the file

An unclosed bracket or brace anywhere earlier is only detected when the parser runs out of input. Check that every opening bracket has a match.

Large numbers changed value

JavaScript numbers are IEEE-754 doubles, exact only to 2^53. An ID larger than that cannot round-trip; it needs to be a string in the source data.

Common mistakes to avoid

  • Pasting a JavaScript object literal and expecting it to validate. Unquoted keys and single quotes are valid JavaScript and invalid JSON.
  • Assuming a formatter fixes invalid JSON. It reports the problem; it cannot guess the intent.

Pro tips

Tips for better results

  • Debugging

    Check for a trailing comma before anything else

    If a file is rejected, check for a trailing comma before a closing bracket first — it is by far the most common cause.

  • JSONC

    Comments make it JSONC, not JSON

    JSON with comments is a different format (JSONC) used by some tools. Strip them before validating here.

  • Precision

    Send large integer IDs as strings

    Large integer IDs are safer transmitted as strings, precisely because of the precision limit above.

Standards and terms behind the JSON Formatter

The named things this tool works with, and the documents that define them.

JSON (RFC 8259)Specification
The data interchange format of the web: objects, arrays, strings and numbers. Reference: JSON (RFC 8259)
IETFWho made it
The body that publishes RFCs, including those defining WebP, FLAC, Opus, Matroska and JSON.
Unicode and UTF-8Specification
The character set and encoding that let one text file hold every writing system.

Also searched as: pretty print json, minify json, indent json, json beautifier online.

Why the error position matters

Browsers report JSON parse failures as a character offset: "Unexpected token } in JSON at position 1043". Nobody can count to 1,043. This tool converts the offset into a line, a column and the offending line itself, with a caret under the exact character.

The things JSON does not allow

Most parse failures are one of a short list, all of which are legal in JavaScript and not in JSON:

  • Trailing commas. {"a": 1,} is valid JavaScript and invalid JSON.
  • Single quotes. JSON strings and keys must use double quotes.
  • Unquoted keys. {name: 1} must be {"name": 1}.
  • Comments. JSON has no comment syntax at all.
  • NaN, Infinity, undefined — none of these exist in JSON. Use null.

Formatting versus minifying

Formatting adds indentation and line breaks for reading. Minifying strips every byte of whitespace for transmission. They are the same data — parsing either produces an identical structure — so the choice is purely about whether a human or a network is the next consumer.

Note that formatting also normalises the document: key order is preserved but duplicate keys collapse to the last one, and numbers are re-serialised, so 1.0 comes back as 1.

Why it matters where JSON is formatted

JSON pasted into a formatter frequently contains API responses, tokens and customer data. This tool parses in your browser and sends the document nowhere — you can confirm in DevTools that no request carries it. Many online formatters send the document to a server to format it.

Privacy

The JSON Formatter runs entirely in your browser. What you enter and the result it produces stay on your own device — nothing is sent anywhere, because nothing needs to be.

You can confirm this rather than take our word for it: open your browser’s developer tools, watch the Network tab, and use the tool. No request carries your input. It also keeps working with the connection off.

Details are in the privacy policy.

What next?

For checking shape and types, not just syntax.

Validate against structure

JSON Formatter — questions

Why does my JSON say "unexpected token"?

Almost always a trailing comma, a single quote where a double quote belongs, an unquoted key, or a comment. The error panel above shows the exact line and column with a caret under the offending character.

Are comments allowed in JSON?

No. The JSON specification has no comment syntax. Some parsers accept them as an extension (JSON5, JSONC), but standard JSON.parse will reject them.

Does formatting change my data?

It re-serialises it. The structure and values are identical, but whitespace changes, duplicate keys collapse to the last occurrence, and numbers are normalised — 1.0 comes back as 1.

Is my JSON sent to a server?

No. Parsing and formatting happen entirely in your browser. This matters because JSON pasted into a formatter often contains tokens, API responses and customer data.

Part of Developer Tools · Browse every tool