JSON Formatter
Make JSON readable with consistent indentation, or minify it to one line. Invalid JSON is reported with the exact line and column.
About the JSON Formatter
JSON from an API response, a log line or a minified config file often arrives as one long line. That is fine for a machine but hard for you to read, review or compare. This formatter rewrites the same data with consistent line breaks and indentation, or squeezes it back onto one line when size matters more than readability.
It is mostly used by developers, testers and support staff who need to inspect payloads, by people editing configuration files, and by anyone pasting JSON into documentation or a bug report.
When to use it
- You copied a minified API response from the browser’s network panel and need to find one field.
- You want two JSON files indented the same way before comparing them with the text compare tool.
- You need a compact single-line version of a config to paste into an environment variable.
- You want keys in a predictable order so that diffs only show real changes.
Worked example
Paste this one-line input, keep 2 spaces and tick Sort keys:
{"name":"Asha","id":12345678901234567890,"tags":["admin","editor"],"active":true}
The result is:
{
"active": true,
"id": 12345678901234567890,
"name": "Asha",
"tags": [
"admin",
"editor"
]
}
The 20-digit id is copied exactly as written. Many tools would round it to 12345678901234567000.
Good to know
- Indentation choices are 2 spaces, 4 spaces, tabs, or Minify (one line).
- Sort keys sorts every object at every level, by character code, so
"B"comes before"a". It applies to the indented outputs only; Minify keeps the original key order. - Strings are kept exactly as typed. An escape such as
éstays aséand is not turned intoé. - Input must be strict JSON. Comments, single quotes and trailing commas are rejected with a line and column, so the formatter never guesses at what you meant.
- The input limit is 20 million characters, and nesting deeper than 500 levels is refused.
- The result can be copied or downloaded as
formatted.json.
How to use JSON Formatter
- Paste your JSON.
- Choose the indentation or Minify, and optionally sort keys.
- Select Format JSON, then copy or download the result.
Privacy: how it works
Everything happens in your browser. Your text is not sent to any server.
Frequently asked questions
Will large numbers lose precision?
No. Numbers are kept exactly as written, so IDs such as 12345678901234567890 are not rounded.
Does it accept comments or trailing commas?
No. The formatter follows the strict JSON standard (RFC 8259) and points to the exact problem so you can fix it.