JSON formatter
Validate, pretty-print and minify JSON. Errors with line and column.
Everything runs in your browser – the JSON is never sent anywhere. Numbers are kept exactly as written, even beyond JavaScript's precision.
▸ About this tool
About the JSON Formatter & Validator
Introduction
JSON (JavaScript Object Notation) is the most common format for exchanging data between programs: REST and GraphQL APIs, configuration files, logs, NoSQL databases and message queues all speak it. Machines are happy with a single long line of JSON, but people are not. This tool turns any JSON into a readable, consistently indented document, squeezes it back into one line when you need to ship it, and tells you exactly where and why a document is invalid.
How to use it
Paste, type or open your JSON. You can also drop a
.jsonfile anywhere on the page or use Open. The document is validated live as you type.Format (Ctrl + Enter) pretty-prints it with 2 spaces, 4 spaces or tabs. Minify removes every unnecessary space and line break.
Tick Sort keys to order object keys alphabetically – handy before comparing two documents in a diff tool.
Copy the result, save it as a file, or undo with Ctrl + Z.
Short links: develzone.org/json opens the formatter, develzone.org/minify minifies whatever you hand over to it. Pasting JSON into the search box on the home page brings you here too.
Errors explained in plain words
Instead of a generic "Unexpected token", the validator shows the line and column of every problem, underlines it in the editor and explains the usual cause:
Trailing comma –
[1, 2, 3,]is fine in JavaScript, but not in JSON.Single quotes – strings and keys must use double quotes:
"name", not'name'.Unquoted keys –
{name: "x"}is a JavaScript object literal; JSON needs{"name": "x"}.Comments – standard JSON has none. Tick Allow comments & trailing commas for JSONC files such as
tsconfig.jsonor VS Code settings; the output is always strict JSON.Values JSON does not know –
undefined,NaN,Infinityor Python'sTrue/None.Raw line breaks or tabs inside strings – they have to be escaped as
\nand\t.Duplicate keys are technically allowed, but most parsers silently keep only the last value, so they are reported as warnings.
Your numbers stay exactly as they are
Many online formatters run JSON.parse followed by JSON.stringify. That quietly changes data: JavaScript numbers have about 15–17 significant digits, so a 64-bit ID like 12345678901234567890 becomes 12345678901234567000, and 1.10 turns into 1.1. This formatter works on the syntax tree of your original text and copies every number and string character for character – only whitespace and (optionally) key order change.
Privacy
Formatting and validation run entirely in your browser. The JSON is never uploaded, logged or stored, so API responses with tokens or personal data are safe to paste. It also keeps working offline once the page has loaded.
A bit of history
JSON was specified by Douglas Crockford in the early 2000s as a subset of JavaScript object literals. It was standardised as ECMA-404 (2013) and RFC 8259 (2017), which also requires JSON exchanged between systems to be encoded as UTF-8. Its tiny grammar – objects, arrays, strings, numbers, true, false and null – is the reason it replaced XML as the default format of web APIs.
Interesting facts
The whole JSON grammar fits on a business card; Crockford famously printed it on the back of his.
JSON has no date type. Dates are usually ISO 8601 strings (
"2024-11-09T11:00:00Z") or Unix timestamps – our Unix timestamp converter translates between the two.Coming from XML? The XML to JSON converter hands its result straight to this formatter.