Tools
EN

JSON Formatter and Validator

Paste JSON to format it with 2 or 4 spaces or tabs, validate it with exact error positions, fix common mistakes with Repair, sort keys or minify it. Big numbers and key order stay exactly as written.

Private: your data is processed in your browser and never uploaded.

How to format JSON

  1. Paste your JSON, drop a .json file onto the editor or load it from a URL.
  2. Click Format (or press Ctrl+Enter) and choose 2 spaces, 4 spaces or tabs. Minify removes all whitespace and Sort keys orders the properties alphabetically.
  3. If the JSON is invalid, the error box shows the line, the column and the cause, and the line is highlighted. Repair fixes trailing commas, comments, quotes and similar mistakes automatically.

A JSON formatter that keeps your data intact

Many online formatters run your data through JSON.parse and JSON.stringify, which silently changes it: large integers such as 12345678901234567890 are rounded, 1.50 becomes 1.5 and numeric keys like "10" jump to the top of an object. This JSON formatter only changes whitespace, so every number, escape sequence and key stays exactly as you wrote it.

What Repair fixes

JSON copied from JavaScript code, Python, logs or AI chat answers is often almost valid. Repair turns it into strict JSON:

ProblemBeforeAfter
Trailing comma{"a": 1,}{"a": 1}
Comments// note, /* … */removed
Single quotes{'a': 'b'}{"a": "b"}
Unquoted keys{a: 1}{"a": 1}
Python valuesTrue, False, Nonetrue, false, null
NaN, Infinity, undefined{"x": NaN}{"x": null}
Missing commas[1 2 3][1, 2, 3]
Unclosed brackets{"a": [1, 2{"a": [1, 2]}
Several values (JSON Lines){"a":1} {"a":2}[{"a":1}, {"a":2}]

Format JSON in code and on the command line

Note that these all re-encode the data, so very large numbers may be rounded – unlike the formatter on this page.

Why use JSON Format Online?

Frequently asked questions

Is my JSON uploaded to a server?

No. Formatting, validation and repair run entirely in your browser. Only Load URL fetches the file through our server, because browsers block most direct downloads from other sites; the content is passed straight to you and not stored.

Why does my JSON fail with “Unexpected token”?

JSON is stricter than JavaScript: keys and strings need double quotes, trailing commas and comments are not allowed, and values like NaN or undefined do not exist. The validator names the exact problem and position, and Repair fixes most of these mistakes automatically.

Does formatting change my numbers or key order?

No. Big integers, trailing zeros, escape sequences and the order of keys are kept exactly. Only Sort keys reorders properties, and even then every number keeps its original digits.

How large can the JSON be?

Files of tens of megabytes work in a modern desktop browser. The editor draws line numbers only for the visible lines, so long documents stay fast, and errors are reported even deep inside large files.