JSON Formatter / Validator

Format, validate, and minify JSON. Sort keys, escape unicode, clear parse errors. Client-side.

Format, validate, and minify JSON. Paste JSON, get clean output or a compact single line — errors show line and column. Nothing sent to a server. How to use ↓·Shortcuts ↓
Paste JSON, get clean, readable output.
Indent:
Samples:
Drop a JSON file here to format it, or click to browse
JSON Input
Formatted Output
Output will appear here.
Input: 0 chars · 0 bytesOutput: 0 chars

How to use

Paste JSON into the left pane, or drop a file onto the drop zone. The output updates live as you type — formatted with your chosen indent in Format mode, collapsed to one line in Minify mode.

If the input isn't valid JSON, the output pane shows the parse error with the line and column where it occurred, so this doubles as a validator — there's no separate "validate" button to press.

Copy the result with the Copy button, or download it as formatted.json / minified.json. The stats footer tracks size, top-level key count, and nesting depth as you go.

Keyboard shortcuts

Three shortcuts:

Cmd / Ctrl + KFocus the input pane
Cmd / Ctrl + EnterCopy the output to clipboard
Cmd / Ctrl + /Switch between Format and Minify

When to use it

Format when you need to read; minify when you need to ship.

  • Making a minified API response readable before debugging against it.
  • Checking whether a hand-edited config file is still valid JSON.
  • Normalizing indentation before committing a JSON file to version control.
  • Sorting keys to diff two JSON documents that differ only in key order.
  • Minifying a payload before embedding it in a query string, env var, or fixture.

If you mainly want to explore a deep structure rather than re-print it, the JSON Tree Viewer is the better fit.

Options

Indent — 2 spaces (default), 4 spaces, or a tab character per nesting level. Only shown in Format mode; Minify always produces a single line with no whitespace between tokens.

Sort keys A→Z — recursively sorts every object's keys alphabetically, at every nesting level, in both modes. Values and array order are untouched. Useful for stable diffs.

Escape non-ASCII — replaces every character above U+007E in the output with its \uXXXX escape. The result is pure ASCII and still parses to the exact same strings.

Format-specific gotchas

Big numbers lose precision. JavaScript parses JSON numbers as IEEE 754 doubles, so integers beyond 253−1 (like 64-bit IDs) get rounded, and long decimals may re-print differently. If exact digits matter, keep them as strings.

Duplicate keys collapse. JSON with the same key twice in one object is parsed by keeping only the last occurrence — the earlier value silently disappears from the output.

Trailing commas are invalid. {"a": 1,} is legal in JavaScript but not in JSON — the tool rejects it with an error. Same for single quotes and unquoted keys; convert loose JS-object syntax with the JSON ↔ JS Converter first.

Comments are not JSON. // and /* */ comments belong to JSONC/JSON5, not RFC 8259 JSON, and will fail validation here.

Privacy

Everything runs in your browser. Your JSON never leaves the page — no server, no logging, no analytics on the content.

Frequently asked questions

Is my JSON uploaded anywhere?
No. Parsing, formatting, and minifying all happen in your browser with the native JSON engine. The input never leaves the page — no server, no logging.
What is the difference between Format and Minify?
Both parse your JSON and re-print it. Format adds indentation and line breaks for readability; Minify strips all insignificant whitespace into a single line for the smallest size. The data is identical either way.
Why did my large numbers change?
JavaScript stores JSON numbers as IEEE 754 double-precision floats. Integers above 9007199254740991 (2^53 − 1) cannot be represented exactly and get rounded. Keep 64-bit IDs and high-precision decimals as strings if the exact digits matter.
Does key order matter in JSON?
Per RFC 8259, object member order carries no meaning and parsers are free to ignore it. That is why the Sort keys option is safe: sorted output is semantically identical, and it makes diffs between documents stable.
Is there a maximum input size?
No hard limit — it depends on your browser’s memory. Documents up to a few megabytes format instantly; very large files (tens of MB) may take a moment or hit browser string limits.
Why is my JSON with comments or trailing commas rejected?
Comments and trailing commas belong to JSONC and JSON5, not standard JSON. This tool validates against strict RFC 8259 JSON via JSON.parse. Convert loose JS-object syntax with the JSON ↔ JS Converter first.