JSON Formatter
Turn minified JSON into something you can read.
Paste a single-line API response and get properly indented, readable JSON back. Jsonviewpro validates the input first, so if something is wrong you get the line, the column and a plain-English explanation instead of a cryptic parser message.
Array order is always preserved — only whitespace, and optionally key order, change.
Input JSON
Formatted JSON
What formatting actually changes
Formatting — also called pretty-printing or beautifying — parses the document into memory and writes it out again with line breaks and indentation, so its structure becomes visible. Whitespace between tokens carries no meaning in JSON, which is why a formatted document and a minified one parse to exactly the same value.
{"order":{"id":"ord_48821","status":"shipped","items":[{"sku":"KB-MECH-87","qty":1},{"sku":"MS-ERG-02","qty":2}],"total":12858.46}}{
"order": {
"id": "ord_48821",
"status": "shipped",
"items": [
{ "sku": "KB-MECH-87", "qty": 1 },
{ "sku": "MS-ERG-02", "qty": 2 }
],
"total": 12858.46
}
}Same keys, same values, same array order. The only difference is that a person can now find the line they care about.
How to format JSON here
- Paste your JSON into the editor, drop a
.jsonfile onto it, or press Upload. Nothing is sent anywhere — the parse happens in this tab. - Choose an indentation width, and optionally turn on Sort keys.
- Press Format, or use
Cmd/Ctrl + Enter. - Copy the result, or download it as a
.jsonfile.
If the document does not parse, nothing is reformatted. You get the line, the column and a plain-English reason instead — see the validator for the full list of causes.
Choosing an indentation width
What formatting does not preserve
This is the part most formatters never mention, and it matters. Formatting is a parse followed by a re-serialization, so anything the JSON number and string grammar treats as equivalent comes back in its canonical form — not the form you typed.
Object key order *is* preserved unless you ask for sorting, and array order is never touched.
Sorting keys, and when not to
Sorting object keys alphabetically produces a canonical form: two documents containing the same data serialize to identical text. That makes them comparable by eye, by diff, or by checksum.
{
"active": true,
"email": "john@example.com",
"id": 1001,
"name": "John Doe"
}It is the wrong default for anything hand-edited. Configuration files usually put the important settings first on purpose, and alphabetising them destroys that ordering for no gain. Turn it on when you are normalising machine output; leave it off otherwise.
Array items are never reordered. Object key order carries no meaning in JSON; array order carries all of it.
Formatting large documents
Formatting is memory-bound rather than CPU-bound: the parsed object graph is typically several times larger than the text that produced it. A 50 MB file can occupy a few hundred megabytes once parsed, which is what actually limits a browser tab.
Jsonviewpro parses and re-serializes in a Web Worker, so the interface stays responsive while it works, and it warns before opening a file large enough to strain the tab. If you are routinely formatting files that big, do it from the command line instead — the section below shows how.
Formatting outside the browser
# jq — the standard tool, formats by default
jq . input.json > output.json
# jq with 4 spaces, and with keys sorted
jq --indent 4 -S . input.json
# Python, no extra install
python3 -m json.tool --indent 2 input.json output.json
# Prettier, for a whole repository
npx prettier --write "**/*.json"All of them parse and re-serialize, so all of them are subject to the same caveats above — jq is the exception on large integers, because it keeps higher precision than a JavaScript engine does.
For a repository, put formatting in a pre-commit hook or in CI so it happens identically for everyone. The point is not the formatting itself; it is that nobody has to think about it again.
Why a document will not format
A formatter can only re-serialize something it can parse, so every formatting failure is a syntax error. In practice it is almost always one of these:
{ "roles": ["admin", "user",] } ← trailing comma
{ 'name': 'John' } ← single quotes
{ name: "John" } ← unquoted key
{ "a": 1 } // note ← comments are not JSON
{ "ok": True, "n": NaN } ← Python / JS literals
{ "a": 1 "b": 2 } ← missing commaJsonviewpro names the specific problem, points at the line and column, and — where the fix is unambiguous — offers a one-click repair that shows you exactly what it changed. Your input is never modified without you asking.
Frequently asked questions
Does formatting change my data?
1.0 becomes 1 and 1e3 becomes 1000, and integers larger than 2^53 − 1 lose precision — see “What formatting does not preserve” above.Will it break my 64-bit IDs?
9007199254740993 comes back as 9007199254740992. Every JavaScript-based formatter has this limitation. The durable fix is to have the API send large identifiers as strings.Can I format invalid JSON?
Is there a keyboard shortcut?
Cmd/Ctrl + Enter, or Cmd/Ctrl + Shift + F. Cmd/Ctrl + Shift + M minifies.Does the formatter preserve key order?
What is the largest file I can format?
Is my JSON uploaded to format it?
Related JSON tools
- JSON BeautifierClean up JSON with configurable indentation and key sorting.
- JSON MinifierStrip whitespace and see exactly how many bytes you saved.
- JSON ValidatorCheck syntax with precise line, column and cause.
- JSON ViewerExplore JSON as a collapsible tree with search and copyable paths.
- JSON to YAMLConvert JSON into readable YAML.