BrowserTools

JSON Formatter & Validator

Beautify, validate and minify JSON

By Guga — BrowserTools maintainer, Tbilisi, Georgia Updated 2026-09-06
Free Private No uploads
What is JSON Formatter & Validator?

Formatting JSON is a job the strict parser can do properly, which is what happens here: the text is parsed and then printed back out, so the result is guaranteed to be valid rather than approximately tidy. Beautify gives you a choice of two spaces, four spaces or a tab, the first two matching what most linters and editors produce. Minify removes every byte that is not required, which is what you want in a response body. Validation is genuinely strict — a trailing comma, a single-quoted string, an unquoted key, a comment or the literal NaN is a syntax error, and the parser's message points at the exact character position and line. The output can be copied or downloaded as formatted.json, and key order is preserved exactly as written rather than being sorted.

Format messy JSON with 2 or 4-space indentation, validate it with precise error positions, and minify it back to a compact string. Handles large documents instantly, all locally.

Private JSON Formatter & Validator In Your Browser

JSON Formatter & Validator is processed locally with client-side JavaScript. Your files never touch a server, and there is no queue to wait in.

Step-by-Step

How to use JSON Formatter & Validator

1

Paste your JSON into the input area, which reports the character count as you go.

2

Stay on the Beautify tab and pick an indentation style from the buttons above the field.

3

Switch to the Minify tab to strip the output down to a single line.

4

Copy the result or download it, and read the error message in the output box if the parse failed.

Key Capabilities
  • Indentation choices of two spaces, four spaces or a literal tab
  • One-click minification for production payloads
  • Strict parse errors carrying character position, line and column
  • Copy and download controls, with the download named formatted.json
Common Use Cases
  • A developer taking a minified API response and reformatting it so the structure is readable.
  • Someone debugging a configuration file that stopped loading and needing the syntax error located precisely.
  • A data engineer reducing a large JSON payload before embedding it in a web page.
Clear Answers

Frequently Asked Questions

Why does it reject my trailing comma?
Because JSON does not allow one. A trailing comma after the last member of an object or the last element of an array is a syntax error in the specification and in every mainstream parser, even though several editors accept it and write it for you. Removing the last comma is usually the whole fix, and the error message will point at the character.
Will it strip comments or fix my file for me?
No, because that would mean guessing. The text is parsed and reprinted, so anything the JSON specification forbids is an error rather than something to repair quietly: // comments, /* */ blocks, single-quoted keys, unquoted keys, NaN, Infinity and leading zeros in numbers are all rejected. Clean the source first.
Does a big number survive the round trip?
Not always, and this is worth knowing. Integers beyond 9007199254740991 cannot be represented exactly by a double, so 12345678901234567890 comes back as 12345678901234567000. If you are handling identifiers or 64-bit values, keep them as strings in the JSON to begin with.
Does it reorder my keys?
No. Formatting prints the members in the order they appear, so a deliberate ordering in your source file is preserved. Some formatters alphabetise keys for diffing; this one leaves your ordering alone.

Related Guides

View all guides →