JSON Formatter & Validator

Paste JSON, see it validated and formatted live, as a collapsible tree or as text. Errors point to the exact line and column instead of just "invalid JSON."

Sort keys alphabetically

How it works

Validation runs through JSON.parse, the same native parser your browser and Node.js use at runtime, so whatever passes here is exactly what will parse in production, not an approximation from a lookalike grammar. When parsing fails, the engine reports either a line and column directly or just a raw character position; in the second case the tool slices the input up to that offset and counts newlines to translate it into the line and column you see in the error box. The tree view is built by walking the parsed value recursively into collapsible nodes, and any single object or array with more than 300 entries is truncated in the view only, never in the copied or downloaded output, so a multi-megabyte API dump stays scrollable.

One side effect of round-tripping through the engine is worth knowing: numbers are re-serialized from JavaScript's 64-bit floats. Cosmetic forms normalize (1e2 becomes 100, 0.50 becomes 0.5), and integers beyond 253, such as 19-digit database or Twitter-style IDs, can silently lose their last digits. If your JSON carries IDs that large, keep them as strings before formatting.

Parsing, formatting, and minifying all happen in this page's own JavaScript on every keystroke. You can confirm that yourself: open DevTools, watch the Network tab, and paste a real API response. No request carries your JSON anywhere, which is why pasting payloads with tokens or customer data is safe here.

Common questions

What happens when my JSON is invalid?

You get an error that points to the exact line and column of the problem, not just a generic "invalid JSON" message. Fix that spot and the output updates live as you type.

Is my JSON sent to a server?

No. Parsing, validation, and formatting all happen in your browser with JavaScript's built-in JSON parser. It's safe to paste API responses or config files that contain private data.

What's the difference between tree view and text view?

Tree view shows your JSON as a collapsible tree, so you can fold away objects and arrays you don't care about. Text view gives you the formatted text with your chosen indentation (2 spaces, 4 spaces, or tabs), ready to copy or download as a .json file.

Does formatting or minifying change my data?

No values are touched. Formatting and minifying only change whitespace, and the optional "Sort keys alphabetically" toggle reorders object keys, which almost every parser treats as equivalent. Arrays keep their order either way.