What is JSON formatting?
JSON (JavaScript Object Notation) is a lightweight data interchange format defined by RFC 8259. This free online JSON formatter takes minified or messy JSON and outputs clean, indented, syntax-highlighted JSON that's easy to read and debug. Only the whitespace changes: numbers, strings, and keys are written exactly as you typed them. All processing happens in your browser, so your JSON isn't sent to a server unless you create a share link.
Why validate JSON before you ship it
A single misplaced comma or an unquoted key can break an entire API response, configuration file, or data import. JSON validation catches these problems instantly by parsing your input against the JSON grammar (RFC 8259) and reporting the line and column where parsing failed, with a plain-language description of the problem — so you fix the cause, not the symptom.
Formatting and validation happen together. To format JSON the tool must first parse it, which means invalid JSON is caught in the same step: valid JSON is re-indented and highlighted, while invalid JSON is marked in the editor with the line, the column, and what went wrong, and Go to error moves the cursor straight to it.
Formatting vs. minifying
Formatting — also called beautifying or pretty-printing — adds indentation and line breaks so JSON is easy for a human to read and debug. Minifying does the opposite: it strips every non-essential space and newline to produce the smallest possible payload, which is what you want for production API responses and network requests. Both produce identical data; only the whitespace differs. Numbers such as 1.0 or 1e2 and escapes such as \u00e9 are kept exactly as written.
Common causes of invalid JSON
Most JSON errors come from a small set of mistakes: a trailing comma after the last item, single quotes instead of double quotes, keys left unquoted, a missing comma between items, or an unescaped quote or control character inside a string. Values like NaN, Infinity, and undefined are also invalid in standard JSON.
When a parser reports an error, start at the position it names and scan backwards — the real cause is often a few characters earlier, such as a missing closing brace or bracket that only surfaces later in the text. When a brace or bracket is never closed, this tool's message also says where it was opened.
Big numbers and duplicate keys
Many JSON tools parse your document into JavaScript values and print it again, which quietly changes data: integers above 2^53, such as 64-bit IDs, are rounded (12345678901234567890 becomes 12345678901234567000), 1E400 becomes null, and when a key appears twice only the last value survives. This formatter works on the JSON text itself, so formatting and minifying never change a value.
It also warns about values that other parsers may read differently: integers that can't be stored exactly as double-precision numbers, numbers outside the double-precision range, duplicate keys (RFC 8259 says the names within an object should be unique), and unpaired surrogate escapes such as \ud800.
How to format and validate JSON online
- 1Paste your JSON. Paste or type your JSON into the input panel — an API response, a config file, or a single object.
- 2Choose an action. Select Format to beautify and indent, Minify to remove all whitespace, Validate to check the JSON and see a summary without changing it, or Tree view to browse its structure.
- 3Read any errors. If the JSON is invalid, the tool shows the line and column and what went wrong — for example a trailing comma or single quotes — and Go to error moves the cursor there. Warnings flag duplicate keys and numbers other parsers can't store exactly.
- 4Explore with Tree view. Switch to Tree view to expand and collapse nested objects and arrays, or use Expand all and Collapse all, and inspect the structure visually.
- 5Copy the result. Use Copy output to copy the formatted or minified JSON to your clipboard.
Examples
Beautify messy JSON
Input
{"id":42,"tags":["a","b"],"ok":true}Output
{
"id": 42,
"tags": [
"a",
"b"
],
"ok": true
}Minify formatted JSON
Input
{
"id": 42,
"ok": true
}Output
{"id":42,"ok":true}Trailing comma (invalid)
JSON does not allow a comma after the last element.
Input
{"a":1,"b":2,}Output
Line 1, column 13: Trailing commas aren't allowed in JSON: remove this comma.
Single quotes (invalid)
Keys and strings must use double quotes.
Input
{'name':'Ada'}Output
Line 1, column 2: Property names must use double quotes ("), not single quotes.Big numbers kept exactly
The number and the 1.10 are unchanged; a warning notes that JavaScript would round the ID.
Input
{"id":12345678901234567890,"price":1.10}Output
{
"id": 12345678901234567890,
"price": 1.10
}Duplicate key (warning)
Both members are kept in the output, with this warning.
Input
{"a":1,"a":2}Output
Line 1, column 8: Duplicate key "a" (first at line 1, column 2): most parsers keep only the last value.
JSON data types
Every JSON value is one of six types.
| Type | Example |
|---|---|
| String | "hello" |
| Number | 42, -3.14, 2.5e8 |
| Boolean | true, false |
| Null | null |
| Object | { "key": "value" } |
| Array | [1, 2, 3] |
Frequently asked questions
Is my JSON data sent to a server?
No. All formatting, validation, and minifying happen locally in your browser using JavaScript, so your JSON isn't sent to a server. The only exception is the Share link button, which uploads the current output when you click it.
What does "Unexpected token" mean?
It's how many parsers, including JSON.parse in browsers, say they reached a character that isn't allowed at that point — commonly a trailing comma, single quotes instead of double quotes, an unquoted key, or a missing comma between items. This tool names the line and column instead and says what's wrong in plain words, such as "Trailing commas aren't allowed in JSON: remove this comma" or "Missing comma between properties", and Go to error moves the cursor there.
What is the difference between formatting and validating?
Validate checks your JSON against the JSON grammar (RFC 8259) and shows a summary — the top-level type, the number of objects, arrays, and keys, and the nesting depth — without changing your input. Format parses the JSON and re-prints it with clean indentation. Both report the same errors and warnings, because JSON must be parsed before it can be re-printed.
Can it handle large JSON files?
Yes. Parsing and formatting run in a background thread (a Web Worker), so the page stays responsive, and the output and tree view only draw the lines on screen. Multi-megabyte files format in place with no round trip to a server; the practical limit is your device's memory rather than an upload cap.
Does it support comments or JSON5?
Standard JSON doesn't allow comments, trailing commas, single quotes, or unquoted keys, so those are reported as errors that say what to change. The tool validates against the JSON specification (RFC 8259).
What indentation does it use?
You can choose 2-space or 4-space indentation, in the same layout as JSON.stringify: each member and array item on its own line, and empty objects and arrays written as {} and []. Two spaces is the most common convention and is Prettier's default.
Will formatting change my numbers or keys?
No. Numbers, strings, and keys are written exactly as you typed them — 12345678901234567890 stays 12345678901234567890, 1.10 stays 1.10, and \u00e9 stays escaped — and duplicate keys are kept. Only whitespace changes. The tool warns when a number can't be stored exactly as a double-precision number or a key appears twice, because many other parsers round the number or keep only the last value.
Is it free?
Yes — completely free, with no sign-up, no account, and no usage limits.
Can I convert the formatted JSON to other formats?
Yes. Once your JSON is valid you can convert it with the related JSON to CSV and JSON to YAML tools, or compare two documents with JSON Diff.