How it works
The JSON Formatter parses your input with the browser's own strict JSON.parse, then re-serializes it with consistent two-space indentation. That means the formatted output is not a cosmetic rewrite: it is exactly what a standards-compliant parser understood, key order included. If the input is invalid, the status line shows the real parser error so you can jump straight to the broken token instead of guessing.
Beautify expands compact JSON into a readable, indented document. Minify does the opposite and reports the final character count, which is useful when you are sizing payloads for a query string, a JWT claim, or a configuration file with a length limit. Validate checks the document without rewriting it, so you can confirm that a hand-edited file is still well formed before committing it.
The Tree View tab renders the parsed value as an expandable hierarchy of objects, arrays and primitives. It is the fastest way to inspect a deeply nested API response: instead of scanning brackets, you open the nodes you care about and read the path. The Sample button loads a realistic nested document so you can explore the interface before pasting production data.
Everything happens locally with JSON.parse and JSON.stringify. Your payload is never sent to a server, which makes the tool safe for responses that contain tokens, personal data, or internal hostnames.
Worked example
Paste the compact document {"name":"Ada","tags":["dev","ops"],"active":true} and choose Beautify. The parser reads the three keys and re-emits them with indentation.
| Step | Action | Result |
|---|---|---|
| 1 | Parse the input | JSON.parse accepts the object and returns a JavaScript value. |
| 2 | Re-serialize with spacing | JSON.stringify(obj, null, 2) indents each level by two spaces. |
| 3 | Inspect the tree | The tags array appears as an expandable node with two string children. |
- Paste the JSON: Drop the raw document into the Input JSON field, or load the sample first.
- Choose an action: Use Beautify for readability, Minify for compactness, or Validate to check without changes.
- Read the status: A green badge confirms valid JSON; an error badge quotes the parser message.
- Inspect or copy: Open the Tree View tab to explore nodes, or copy the formatted output.
The same value minifies back to {"name":"Ada","tags":["dev","ops"],"active":true}, and the minify status confirms the exact character count. Round-tripping is lossless because both directions go through the same parser.
Common errors and edge cases
- Trailing commas.
{"a":1,}is valid in JavaScript object literals but not in JSON. Remove the final comma before the closing brace. - Single quotes. JSON strings must use double quotes. Replace
'key'with"key"throughout the document. - Comments. JSON has no comment syntax. Strip
//and/* */blocks, or move the note into a"_comment"key. - Undefined and functions. Values such as
undefined, functions and symbols are not JSON. They disappear or throw during parsing. - Concatenated documents. Two JSON texts pasted back to back are invalid together; format them one at a time or wrap them in an array.
Code equivalents
The same operations are one-liners in most runtimes, which is handy when you want to reproduce the tool's behavior in a script.
| Language | Example |
|---|---|
| JavaScript | JSON.stringify(JSON.parse(input), null, 2) beautifies; JSON.stringify(JSON.parse(input)) minifies. |
| Python 3 | json.dumps(json.loads(input), indent=2) beautifies; json.dumps(json.loads(input), separators=(',', ':')) minifies. |
| Command line | python3 -m json.tool file.json prints the indented document or reports the first parse error. |
Related tools
Frequently asked questions
Why does the formatter reject JSON that works in my JavaScript console?
The console accepts JavaScript object literals, which allow single quotes, trailing commas and unquoted keys. Strict JSON does not. The tool applies the JSON standard, so clean up those three differences first.
Does beautifying change my data?
No. The value is parsed and re-serialized; only whitespace changes. Key order, number formatting and string content are preserved by the parser.
Can I format a JSON file that is several megabytes?
Yes, within browser memory limits. Because parsing is local, large files are only constrained by your machine, not by an upload quota.
What does the tree view add over formatted text?
It lets you collapse branches of a deeply nested document and read one path at a time, which is faster than scrolling through indentation levels.
Is my JSON uploaded anywhere?
No. Parsing and serialization run entirely in your browser. Nothing you paste is transmitted to ToolPlex.
Privacy note
All processing happens in your browser. The values you enter never leave your device and are never transmitted to ToolPlex.