JSON Formatter
Turn a single-line API response into readable, indented JSON — and find out exactly where the syntax breaks if it does not parse.
Your data stays on your device
Input — JSON
- characters
- 0
- lines
- 0
- size
- 0 B
Output — Formatted JSON
- characters
- 0
- lines
- 0
- size
- 0 B
Options
Makes two documents comparable with a plain text diff.
Keeps integers beyond 2^53-1 exactly as written instead of rounding them. Key sorting is skipped in this mode.
About this tool
A JSON formatter re-prints a JSON document with consistent indentation and line breaks so a human can actually read it. Log files, HTTP responses and database columns usually store JSON minified, which is efficient for machines and hopeless for debugging.
This formatter parses the document first, so anything it prints is guaranteed to be valid JSON. If parsing fails you get the line, the column and a plain-English description of what the parser expected instead of a raw engine message.
How to use this tool
- Paste your JSON into the input panel, upload a .json file, or drop a file onto the editor.
- Pick an indentation style: 2 spaces, 4 spaces, or a tab character.
- Optionally enable "Sort object keys" to alphabetise every object, which makes two documents comparable.
- Press Format (or Ctrl/Cmd + Enter) and copy or download the formatted output.
Key features
- Indent with 2 spaces, 4 spaces or tabs
- Recursive alphabetical key sorting for stable diffs
- Big Number mode preserves integers beyond 2^53-1 exactly
- Syntax errors reported with line, column and a suggested fix
- One-click minify for the reverse operation
- Copy to clipboard and download as .json
- Load a sample document to try the tool without pasting real data
Example
Input — JSON
{"id":42,"name":"Ada","langs":["ts","go"],"active":true}Output — JSON
{
"id": 42,
"name": "Ada",
"langs": [
"ts",
"go"
],
"active": true
}Good to know
- Comments and trailing commas are not valid JSON and will be reported as errors. Use the JSON Validator page to identify them.
- Very large documents (tens of megabytes) are limited by available browser memory since nothing is streamed to a server.
- By default, integers beyond 2^53-1 are rounded like any JavaScript-based tool. Enable Big Number mode to keep them exact; that mode skips key sorting.
Frequently asked questions
Is my JSON uploaded anywhere?
No. Parsing and printing happen in JavaScript inside your own browser tab. The page makes no network request with your content, which is why the tool still works if you go offline after loading it.
What indentation should I use?
Two spaces is the most common convention for JSON in web projects and produces the smallest readable output. Four spaces suits deeply nested configuration files. Tabs are useful when your team relies on editor-configurable indent width.
Why does sorting keys matter?
JSON objects have no defined key order, so two logically identical documents can produce a noisy diff. Sorting both sides alphabetically makes a line-based diff meaningful.
Can it fix my broken JSON automatically?
It does not silently rewrite your input. It reports where the problem is and what is likely missing — a comma, a closing brace, a quotation mark — so you stay in control of the correction.
Your data stays on your device
Your data is processed locally in your browser and is not uploaded to our server. This page keeps working after you go offline, because there is nothing to send.