Free tools Developer

Format, validate and minify JSON without uploading it

Paste JSON to pretty-print it with the indent you like, minify it, or check it and see exactly where the first mistake is. Everything runs in your browser, nothing is uploaded, and keys stay in their original order unless you ask to sort them.

Indent with

Format and Sort keys use the indent you pick. Minify removes every space and line break outside strings. Keys stay in their original order unless you press Sort keys.


0 bytes · 0 lines

Everything runs on your device. Your JSON is never uploaded or stored.


What each button does

The formatter works on the text itself rather than through JSON.parse, so a number written as 1.0 stays 1.0, escapes stay escapes, and keys move only when you ask.

Format

Rewrites the whitespace between values with your indent, one value per line, and changes nothing else.

{"a":[1,2]} → {
  "a": [
    1,
    2
  ]
}

Minify

Removes every space, tab and line break outside strings: the smallest text that still parses to the same value.

{ "a": [ 1, 2 ] } → {"a":[1,2]}

Sort keys

Orders the keys of every object by character code, at every depth, then formats. Arrays keep their order.

{"b":1,"a":{"d":1,"c":2}} → {
  "a": {
    "c": 2,
    "d": 1
  },
  "b": 1
}

Validate

Checks the whole document and reports the first problem with its line, its column and an excerpt of that line.

[1, 2,] → Line 1, column 6. Trailing comma


Questions

Built by Mohd Shayan. Found a problem or have an idea? Send a note.

Is my JSON uploaded anywhere?

No. Formatting, minifying, sorting and validation run in your browser with plain JavaScript, and the page makes no network request with your text. Nothing is stored either: the box is empty again when you come back. That is also why a 5 MB document is fine: there is no upload to wait for, only the work your own device does when you press a button. A result longer than 200,000 characters is shown in part, to keep the page quick, while Copy and Download always use the whole result.

What does Format change?

Only the whitespace between values. The formatter works on the text itself rather than through JSON.parse, so numbers stay exactly as written (1.0 stays 1.0 and 1e400 is not turned into null), unicode escapes stay escapes, keys keep their original order and even duplicate keys survive. Minify removes every space, tab and line break outside strings and nothing else.

How much does Minify save?

It depends on how much whitespace the document carries. The example on this page is 269 bytes as pasted and 221 bytes minified, a saving of 48 bytes or 17.8%; formatted with 2 spaces it is 329 bytes, so minifying that formatted text saves 108 bytes or 32.8%. Deeply nested documents with short values save the most. A document that is mostly long strings saves little, because nothing inside a string is touched. The result line shows the bytes in, the bytes out and the percentage saved.

How do I read the error message?

Validation stops at the first problem and gives its line and column, both counted from 1, with an excerpt of that line in which the offending character is highlighted. Press Go to line to put the cursor there. For [1, 2,] it reports line 1, column 6: Trailing comma: remove the comma before ]. The usual culprits are trailing commas, single quotes, unquoted keys, comments and a missing comma between two values, none of which JSON allows.

How are keys sorted?

Only when you press Sort keys; Format and Minify never move a key. Sorting applies at every depth, so nested objects are sorted too, while arrays keep their order. Keys are compared by their character codes, the same order JavaScript's sort() uses, so B comes before a and 10 before 9. A key that appears twice keeps both copies in their original relative order.