About this tool
JSON says nothing about indentation or line breaks, which is why API responses usually arrive minified onto a single line. Formatting re-lays that text out as an indented hierarchy so the nesting becomes readable; minifying does the reverse and strips every unnecessary whitespace character to cut transfer size. Both operations touch whitespace only; never the data.
Strict JSON (RFC 8259) forbids comments, trailing commas, single-quoted strings and unquoted keys, yet config files use all of them: tsconfig.json and VS Code settings.json are JSONC, and some toolchains use JSON5. The parser here accepts all three and re-emits strict JSON, so you can paste a commented config file directly instead of stripping comments by hand first.
When parsing fails the error points at the offending position. The three usual causes are an unescaped double quote inside a string, a trailing comma after the last member of an object, and escape backslashes picked up when copying out of a log line. The last two are what JSON Repair is for.
How to use it
Paste or type your JSON
The input accepts pasted and typed text. Roughly 300 ms after you stop typing it formats once automatically, so normal use needs no button press.
Pick an output shape
Format emits multi-line JSON with two-space indentation; Minify emits a single line with all whitespace removed. URL and Uni codecs recursively transform string values only, preserving keys, arrays, and object structure.
Locate fields in the tree view
Formatted output renders as a collapsible tree. For deeply nested documents, collapse everything first and expand down to the path you care about; faster than counting brackets in plain text.
Copy or download the result
Copy writes the current output to the clipboard. Download saves the complete formatted, minified, or value-transformed JSON as formatted.json.
Input and output example
The same document in both shapes. The minified form fits in an environment variable or request body; the formatted form is what you want in review.
{"name":"ToolGarden","tags":["json","pdf"],"limits":{"maxDepth":64,"strict":false}}{
"name": "ToolGarden",
"tags": [
"json",
"pdf"
],
"limits": {
"maxDepth": 64,
"strict": false
}
}Supported range and limits
- Accepted input
- Strict JSON (RFC 8259), JSONC (comments and trailing commas), JSON5 (single quotes, unquoted keys, hex numbers)
- Indentation
- Formatting always emits two spaces; minified output contains no whitespace at all
- Number precision
- Parsed as JavaScript numbers, so integers above 2^53-1 lose precision
- Key order
- Preserved exactly as it appears in the input; never alphabetised
- Comments
- Accepted on input, but strict JSON has no comment syntax so they are dropped on output
- Where it runs
- Parsing, formatting and minifying all happen in your browser; the input is never sent to a server
When you would use it
Reading a minified API response
Responses copied from devtools or curl arrive on one line. Formatting plus tree collapse tells you quickly whether a field exists, whether its type is right, and how many entries an array holds.
Putting a commented config into an env var
JSONC files like tsconfig.json or eslintrc cannot go somewhere that only accepts strict JSON. Parse to strict JSON, then minify to one line, and it is safe to drop into a CI environment variable or a CLI argument.
Making a diff show only field changes
Format both documents with the same indentation before comparing, otherwise whitespace noise swamps the real changes. From here you can hand the result straight to JSON Diff.
What to know before you start
- Formatting only rearranges whitespace; keys, values and array order are untouched. If the output data looks different from the input, the input almost certainly had duplicate keys, and the later one wins.
- Numbers go through JavaScript number semantics, so `1.0` comes back as `1` and snowflake-style IDs can lose their last digits. If exact digits matter, carry them as strings at the transport layer.
- Comments in JSONC or JSON5 input disappear from the output. That is a limitation of strict JSON syntax, not the tool dropping content; keep the original file if you need the comments.
- Everything runs in your browser. The page does not upload what you paste, and nothing remains on any server after you close the tab.
Related concepts
- RFC 8259
- The current JSON standard. It defines value types, string escaping and encoding requirements, and it defines no comment syntax and permits no trailing commas.
- JSONC
- "JSON with Comments". Adds // and /* */ comments plus trailing commas on top of JSON, mainly for editor and build-tool configuration files.
- JSON5
- An extension closer to ES5 literals: single-quoted strings, unquoted keys, hexadecimal numbers and multi-line strings.
- Minify
- Removing every unnecessary whitespace character to reach the smallest equivalent text. Lossless, and a different layer from byte-level compression such as gzip.