Paste JSON to check it, pretty-print it or minify it. If it is broken, we point at the line and column.
No sign-up, no fees.
JSON formatter: make one-line JSON readable.
JSON validator: shows the line and column of the error.
2 spaces, 4 spaces, tab or minify.
Option to sort keys A-Z.
What you type is processed, but never shared with anyone.
How to use the JSON Formatter
Is the API response a single line, or is a config file driving you mad with "where is it broken?" Five steps:
Paste the JSON. Paste it into the JSON text box.
Look at the result. If it says Valid JSON on top, you're fine; the formatted version shows below. If it says Invalid JSON, the place of the error is shown.
Pick the indentation.2 spaces, 4 spaces, Tab or Minify (squeezes it into one line).
Sort (optional). Tick Sort keys A-Z; it helps when comparing two JSON files.
Copy. Take the result with Copy.
What is JSON?
JSON (JavaScript Object Notation) is a text format that writes data as key-value pairs and lists, easy for both people and programs to read. Web services (APIs), app config files, database exports and mobile apps mostly carry their data as JSON. Programs usually send JSON as a single line without spaces, which is unreadable to the human eye. What people search for as pretty-print JSON and JSON beautifier is making that text indented and readable line by line.
If there's an error
For broken JSON, instead of a red alarm we tell you what's wrong: something like "Line 3, column 12: ',' is not expected here". Below it you get the line itself and a marker pointing at the faulty spot. The most common causes:
A trailing comma:{"a": 1,} is invalid in JSON.
Single quotes: in JSON, strings are written only with double quotes.
An unquoted key:{name: 1} should be written {"name": 1}.
Comments: JSON has no // or /* */.
Line breaks: a real line break can't be inside a string; you write \n.
What don't we change?
When formatting we keep values as they are. Very large numbers aren't rounded, 1.0 doesn't turn itself into 1, and if the same key appears twice, both stay. We follow the official JSON rules (RFC 8259); loose forms that some programs tolerate give an error here.
Tips for validating JSON
Go to the error line: the line and column number in the error message often points just before the real mistake; look at the comma at the end of the previous line.
To compare two JSONs: format both with Sort keys A-Z, then paste them into Text diff.
Send it minified:Minify is ideal for JSON to be sent over the network or embedded in code.
Common mistakes
Thinking a JavaScript object is JSON: single quotes, comments and trailing commas work in JavaScript, not in JSON.
Pasting secrets carelessly: be careful when sharing data that contains passwords or API keys.
The formatting happens in your browser. What you type is processed, but never shared with anyone. We still recommend not pasting data with secret keys or passwords into random places.
Are JSON and a JavaScript object the same thing?
No. JSON is a text format and its rules are stricter: double quotes, no comments, no trailing commas.
What does "Minify" do?
It removes spaces and line breaks; the content stays the same, the file gets smaller.
What happens with very large files?
It works comfortably up to a few megabytes. With bigger ones the page can slow down.
What does JSON validator mean?
It means a JSON checker: it checks whether the text follows the rules. This tool both validates and formats.
Are accented characters affected?
No. Letters in the text stay as they are.
Can I use it on my phone?
Yes. Paste the JSON; the formatted version shows below.
How do I use the JSON formatter with API responses?
Copy the response from your browser's developer tools or a program like Postman and paste it here. Nested objects are separated by indentation; you see at a glance which field is where. To find a field, you can use your browser's in-page search (Ctrl+F).
Does sorting keys change the data?
No. In JSON the order of an object's keys carries no meaning; sorting only makes reading and comparing easier. The order of arrays (square brackets) never changes.