JSON & XML Formatter

Format, validate and convert JSON and XML. Pretty-print with a collapsible tree view for big files, or convert between JSON, XML, YAML, CSV, TypeScript and key=value pairs — all in your browser.

Paste JSON or XML → format, validate or convert → copy the tidy result.

Paste JSON to format, validate or minify it — everything runs locally in your browser and your data is never uploaded.

Output appears here — it also runs automatically as you type.
/* single ad unit — insert AdSense/Ezoic code here */

What this tool does

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.

Formatting is not validation. Formatting changes how the data is displayed — indentation and spacing — so nested objects and arrays are easier to read. It does not change the data itself, and it does not automatically make invalid JSON valid. If the input has a syntax error, that error must be fixed before the document will format cleanly.

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.