Back

JSON Formatter

Validate, format and minify JSON. Browse it as a tree, query it with JSONPath, compare two documents or check one against a JSON Schema.

Or drop a JSON file here, up to 2 MB. It isn't uploaded.

How to use this tool

  1. Paste your JSON

    Paste a raw API response, minified body, or hand-written JSON into the input field. The formatter parses it on every keystroke, so valid input updates the output instantly and invalid input shows the exact line and column of the first parse error.

  2. Choose format or minify

    Leave indentation on for a readable, prettified view with 2-space nesting, or toggle Minify to strip all whitespace into a single line for embedding in a URL, cookie, or compact API payload.

  3. Read the structured output

    The output pane shows the reformatted JSON in a readable text area. If parsing fails, the error message points to the first offending character so you can fix the input without guessing.

  4. Query, compare or check a schema

    Pick Query to pull values out with a JSONPath query like $.users[*].name, Compare to see what changed between two documents, or Schema to check the JSON against a JSON Schema. Each mode lists results with their exact paths.

  5. Copy the result

    Use the copy button to grab the formatted (or minified) output and paste it into your code, a curl command, or a config file. Parsing and reformatting happen locally, and the input stays out of the page URL.

About this tool

The JSON Formatter validates, beautifies, and minifies JSON locally in your browser. It also opens JSON as a collapsible tree, runs JSONPath queries, compares two documents and checks JSON against a JSON Schema. Paste a raw API response and get indented, readable output, with parse errors shown by line and column.

The tool doesn't upload the payload for parsing. Your input stays out of the address bar too, so it won't show up in browser history or in a link you share unless you choose to include it.

Use it when JSON arrives as a single minified line and you need to read it, when you're writing JSON by hand and want to verify it parses before deploying, or when you want to shrink a bloated payload for embedding in a URL, cookie, or environment variable. Pretty-print for humans or minify for the wire, each in a single click on the same input.

What it does

Parses JSON according to RFC 8259 (strict JSON, no comments or trailing commas), reformats it with 2-space indentation, or strips every byte of whitespace for minified output. Errors include the line and column of the first parse failure so you can fix the input fast.

Tree, query, compare and schema

  • The tree view is for reading big nested responses one branch at a time.
  • Query mode answers questions like which orders cost more than 100, with standard RFC 9535 JSONPath.
  • Compare mode shows what an API change or a config edit did, without the noise of reordered keys.
  • Schema mode tells you whether a payload fits its contract, with the failing path and the schema keyword for each problem.

All four read numbers by their written digits, so IDs and amounts past the JavaScript safe range stay correct.

When to use it

Daily dev work: debugging API responses, preparing seed data, reviewing logs, or validating that a config file is well-formed before running a deploy. Pair with the Encoding Converter when the JSON is wrapped in Base64, and the Unix Timestamp tool when the payload contains epoch time values that need human translation.

Guides to common JSON workflows and troubleshooting questions.

Frequently asked questions

How do I format a minified JSON string?
Paste it into the input field and the formatted, indented version appears in the output, no button press required. The formatter uses 2-space indentation by default, a common style in APIs and linters.
Why is my JSON invalid?
Most common reasons: single quotes instead of double, trailing commas after the last element of an array or object, unquoted keys, or unescaped special characters inside strings. The formatter points to the exact line and column where parsing failed.
How do I minify JSON?
Use the Minify option to strip all whitespace and produce a single-line string suitable for embedding in a query parameter, cookie value, or API body where payload size matters. Minifying a typical 10 KB formatted payload saves around 20-30% of bytes.
Is the JSON I paste sent to a server?
No. Formatting, the tree view, JSONPath queries, comparisons and schema checks all run locally in your browser, and the tool doesn't upload your JSON, the second document or the schema. They also stay out of the page URL, so they don't land in browser history. Share and Save links carry only your settings unless you choose to include the text.
Can I format JSON5 or JSONC?
Not directly. The formatter validates strict JSON only (RFC 8259). If you're working with JSONC (JSON with comments, used by VS Code settings) or JSON5 (trailing commas, unquoted keys), strip those extensions first or the parser will reject them.
How do I browse JSON as a tree?
Switch the output from Text to Tree. Each object and array opens and closes on click or with the arrow keys, and the bar under the tree shows the path of the selected value, like $.users[0].email. Copy path and Copy value work on any branch or single value. The tree keeps keys in their written order, shows every copy of a repeated key, and flags numbers that JavaScript would round.
Which JSONPath syntax does the Query mode support?
The standard version from RFC 9535: dot and bracket names, wildcards, indexes, slices like [0:2], the .. descendant step, filters like [?@.price < 10] with && || and !, and the functions length(), count(), match(), search() and value(). Older tool-specific syntax, like script expressions, isn't supported and shows a clear error with the position. Every result path is itself a valid query.
How does Compare decide what changed?
It compares structure, not text. Whitespace and the order of object keys never count. Arrays keep their order by default and are lined up so one inserted item shows as one addition, or you can pick Ignore array order to match equal items anywhere. Numbers compare by value, so 1.0 equals 1, but 9007199254740993 and 9007199254740992 are different even though JavaScript reads them as the same number.
Which JSON Schema versions can the Schema mode check?
JSON Schema 2020-12, 2019-09, draft-07, draft-06 and draft-04. The tool reads the version from $schema and uses 2020-12 when there's none. References with $ref, $id, $anchor and $dynamicRef resolve inside the schema you paste. Nothing gets downloaded, so a reference to another file shows an error. Each problem lists the failing path in your JSON and the keyword in the schema.
Why do big numbers stay exact?
JavaScript stores numbers as 64-bit floats, so JSON.parse turns 9007199254740993 into 9007199254740992 and 1E400 into Infinity. This tool reads the digits as written instead. Formatting never changes a number, the tree shows what JavaScript would read next to it, and queries, comparisons and schema limits like maximum or multipleOf all use the exact value.
What's the difference between a JSON object and array?
An object is a collection of key-value pairs wrapped in {} with string keys. An array is an ordered list wrapped in []. Both can be nested arbitrarily deep. APIs usually return one or the other at the top level. Check the opening character to know which you're dealing with.

Use this tool on your own site

Drop the JSON Formatter into your blog, docs, or CMS with one iframe snippet. Free, no signup. See all embeddable tools