JSON Formatter

Beautify, validate and minify JSON online. Pretty-print with indentation or compact it. Fast, private, in-browser.

Examples
Convert to
String tools
Export options

How to format JSON

Paste your JSON and click Format to pretty-print it (choose your indent and optionally sort keys), or Minify to compact it. Invalid JSON shows the exact line and column of the error, and a collapsible tree view lets you explore the structure. Everything runs in your browser — your data is never uploaded.

FAQ

Does it validate JSON and point to the error?

Yes. Invalid JSON shows a clear message with the exact line and column of the problem, so you can jump straight to it.

Can I sort keys or change the indentation?

Yes. Tick "Sort keys" to alphabetize every object recursively, and choose 2 spaces, 4 spaces or tabs for the indent.

What is the tree view for?

After formatting, a collapsible tree lets you explore large JSON by folding objects and arrays, with color-coded value types and counts — much easier than scrolling raw text. Every node has a "path" button that copies its exact JSONPath.

How do JSONPath queries work?

Type an expression like $.users[0].email or $..id and press Query. Matching values are printed below and the matching nodes are highlighted in the tree, with the view scrolled to the first hit. Supported syntax: $, dot keys, [n], [*] and the recursive $..key.

Can it convert JSON to TypeScript, Go or a schema?

Yes. One click generates TypeScript interfaces, Go structs with json tags, a JSON Schema (2020-12) or a Zod schema — all inferred from your data, entirely offline.

Does it handle very large files?

Yes. Above 1 MB the tree switches to lazy rendering: children are built only when you expand a node, so even multi-megabyte JSON stays responsive.

What do Escape and Unescape do?

Escape turns raw text into a quoted JSON string (handy for embedding JSON inside JSON); Unescape parses a quoted JSON string back into the original text.

Is my data sent anywhere?

No. Formatting, validation, queries and all conversions happen entirely in your browser.

Last updated: