Skip to content

Format and validate JSON

Beautify, minify and validate JSON with exact error locations, fix hints and a collapsible tree view; your data is processed in your browser and never uploaded.

Formatted JSON appears here.
Runs in your browser · no uploadHow it works

How to use JSON formatter & validator

  1. 1

    Paste or open JSON

    Paste into the left box, drop a .json file on it, or use Open file. Try Sample to see how it works.

  2. 2

    Choose the layout

    Pick 2 spaces, 4 spaces or tabs, switch on Sort keys A–Z if you want stable ordering, then press Format JSON or Minify.

  3. 3

    Fix any error

    If the JSON is invalid, read the line, column and hint, jump to the spot with Go to line, or press Repair JSON.

  4. 4

    Copy, download or explore

    Copy the result, download it as .json, or open the Tree tab to fold nodes and copy a JSONPath.

Limits and Pro

Free with no sign-up: open files up to 50 MB. Input over 200,000 characters is processed in a background worker, files over 2 MB are formatted without being loaded into the editor, and the tree view covers documents up to 2 MB.

Pro removes the ads; the formatter's limits are the same on every plan. See Pro

About JSON formatter & validator

Paste an API response, a config file or a log line and this formatter checks it against the JSON standard (RFC 8259), then prints it with two-space, four-space or tab indentation, or minifies it to a single line. Keys can be sorted alphabetically, which makes two versions of the same document easy to compare.

When the JSON is broken you get the line and column, a plain-English description of what was expected, a caret under the exact spot and a likely fix: a missing comma at the end of the previous line, a trailing comma, single quotes, an unquoted property name, a comment, Python's True or None, NaN, a raw line break inside a string or an unclosed bracket. The Repair button fixes those near-JSON habits in one go and lists every change, so you can review it or undo it.

Numbers and escape sequences are copied exactly as written, so an ID like 12345678901234567890 doesn't get rounded the way JSON.parse would round it. The tree view folds objects and arrays, shows how many keys or items each one holds, and copies the JSONPath or value of any node.

Big files are handled in a background worker, so the page stays responsive while a 50 MB export is formatted. The tool doesn't validate against a JSON Schema, convert to YAML or CSV, or query data with JSONPath expressions.

Privacy

Parsing, formatting and repairing happen in this browser tab; the JSON you paste or open is never uploaded or sent to any service. Only your indentation and sort-keys choices are saved in local storage — the document itself is not kept after you close the page.

Features

Errors you can act on

Line, column, a caret under the problem and a suggested fix instead of “Unexpected token”.

One-click repair

Turns JSON with comments, trailing commas, single quotes or bare keys into strict JSON.

Collapsible tree

Fold any object or array and copy the JSONPath or value of a node.

JSON formatter & validator: frequently asked questions

Why does my JSON say “Expected a comma” on a line that looks fine?
The parser notices the problem only when it reaches the next property, so the error points at the start of that line. The comma is usually missing at the end of the line above it, after the previous value. The hint names that line. Press Go to line to jump there, or Repair JSON to insert the missing commas automatically.
What does Repair JSON change?
It removes // and /* */ comments, deletes trailing and doubled commas, converts single-quoted strings, quotes bare property names, replaces True, False and None with their lowercase JSON forms, turns NaN and Infinity into null, escapes raw line breaks in strings and closes brackets left open. Every change is listed afterwards and Undo restores your original text.
Will formatting change my numbers or Unicode text?
No. The formatter keeps each number and string exactly as it appears in your input, including long integers beyond JavaScript's safe range, trailing zeros such as 1.50 and escapes like \u00e9. Only whitespace and, if you ask for it, the order of keys change. Minify removes all whitespace outside strings.
How large a JSON file can I format?
Files up to 50 MB open directly. Anything over 200,000 characters is processed in a background worker with a progress bar and a Cancel button, so the page never freezes. Files above 2 MB are formatted without being loaded into the editing box, and the tree view is limited to documents of 2 MB or less.
Does it detect duplicate keys?
Yes, for documents under 1 MB. Duplicate keys are technically allowed by the JSON grammar, so the document still counts as valid, but you get a warning that names each repeated key and the path of its object. Most parsers silently keep only the last value, which is a common source of configuration bugs.
All developer tools