Paste JSON to format, validate or minify it — everything runs locally in your browser and your data is never uploaded.
What this tool does
- Format & validate JSON or XML. Auto-detects your input (or pick the format), pretty-prints it with 2/3/4-space or tab indentation, and points to the exact spot of any syntax error.
- Collapsible tree view. For large files, switch to Tree view and fold or unfold any branch — each object and array shows its item count, so you can navigate deep structures without scrolling through thousands of lines. Expand-all and collapse-all are one click.
- Convert between formats. JSON → XML, YAML, CSV, TypeScript or key=value; XML → JSON or key=value; and key=value → JSON or XML. Everything round-trips through a common structure so conversions stay consistent.
- key=value pairs. Turn flat
a.b[0]=valuelines into nested JSON or XML, or flatten JSON/XML back into simple pairs — handy for config files and env-style data. - Minify compacts JSON or XML to a single line; Sort keys alphabetises object keys recursively for clean diffs.
- Everything runs in your browser with the native
JSONandDOMParserAPIs — no libraries, nothing uploaded.
Understanding your results
Valid JSON is re-displayed with clear indentation and each key on its own line, so nested structures are easy to follow. You can also minify — strip all the whitespace — to get the smallest version for sending over a network.
If the JSON is invalid, you get an error pointing at the problem rather than silent failure, so you can jump straight to the broken bracket or missing comma.
What counts as invalid JSON?
Common causes are trailing commas, single quotes instead of double, or an unclosed bracket. The error message points you to the spot.
Is my data sent to a server?
No. Formatting and validation happen entirely in your browser.
Can it minify as well as prettify?
Yes — you can expand JSON for reading or collapse it to the smallest valid form.
What JSON is made of
JSON is built from a small set of pieces: objects (key-value pairs in curly braces), arrays (ordered lists in square brackets), strings, numbers, the booleans true and false, and null. Everything nests from those building blocks, which is why the same format can describe both a single value and a deeply structured document.
Formatting versus minifying
Formatting (or "pretty-printing") adds indentation and line breaks so the structure is easy to read. Minifying strips that whitespace to make the payload smaller for transmission. Both describe the exact same data — the whitespace between tokens carries no meaning in JSON, so neither operation changes what the data means.
A before and after
Compact input like {"name":"Ada","skills":["math","logic"]} becomes, when formatted, a version with each key on its own indented line and the array laid out clearly. The values are identical; only the spacing differs.
Common syntax errors
Most JSON errors come from a few habits carried over from JavaScript: trailing commas after the last item, single quotes instead of double quotes, or unquoted keys. Strict JSON requires double quotes around keys and string values, and no trailing commas.
How JSON escaped JavaScript
JSON's syntax was inspired by JavaScript object notation, but it became a language-independent data-interchange format. Its simplicity helped it become common for web APIs and configuration.
Whitespace is mostly for humans
Outside string values, JSON formatting whitespace does not change the represented data. That is why the same document can be pretty-printed for reading or minified for compact transfer.