Skip to content

JSON Formatter

Paste JSON to pretty-print it, minify it or find the first error. It runs in your browser.

An example is filled in. Paste your own JSON over it. Nothing leaves your browser.

Formatted JSON

How it works

The formatter reads your text with a strict JSON parser, then writes the same content back with new spacing. Pretty output puts each array item and object member on its own line, indented by 2 spaces, 4 spaces or a tab. Minified output removes every space outside strings. Nothing else changes: numbers, escapes, key order and duplicate keys come out as you typed them. If the text is not valid JSON, the page shows the line and column of the first problem. Large input is formatted after you stop typing for a moment, so a big paste does not freeze the page.

pretty = every array item and object member on its own line, indented per level

minified = the same tokens with no whitespace outside strings

Worked example

Example input, not real data: { "a" : "x y" , "b" : [ ] }

  1. 1Minify the first example{ "a" : "x y" , "b" : [ ] } = {"a":"x y","b":[]}
  2. 2Find the error in a second example{"a":1,} = Line 1, column 8: Unexpected character "}"

Questions

Does my JSON leave my browser?

No. The text is read, formatted and shown on this page. It is not uploaded, logged or stored.

Why is my text rejected when it looks fine?

JSON is stricter than JavaScript. It does not allow single quotes, unquoted keys, comments, trailing commas, NaN, Infinity or undefined. The error message points at the first character that breaks the rules.

Does it sort keys or change numbers?

No. Keys stay in the order you typed, duplicates included, and numbers such as 1.50 or 12345678901234567890 keep every digit.

How large can the input be?

The page is tested with 1 MB of JSON. Much larger files depend on your device's memory and browser.

How are the line and column counted?

Both start at 1. The column counts characters from the start of the line, and a problem at the very end of the text, such as a missing closing bracket, is reported as the end of input.