Toolbench

JSON formatter and validator

Paste JSON to format it with 2 spaces, 4 spaces or tabs, minify it, or find exactly where a syntax error is.

Runs entirely in your browser. Nothing you type, paste or open here is uploaded to any server.

How do I validate and format JSON?

Parse it with a strict JSON parser; if it parses, re-print it with indentation. Paste your JSON here and it is checked and formatted as you type, with the line and column of any error.

  1. Paste JSON or open a .json file.
  2. Read the status line: valid, or the error and where it is.
  3. Pick an indent and whether to sort keys.
  4. Press Format or Minify.
  5. Copy or download the result.

Examples

A common error

Input

{"name": "Acme", "seats": 5,}

Result

Invalid JSON. Look for a trailing comma before } or ].

Minified

Input

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

Result

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

Frequently asked questions

Why is my JSON invalid when it works in JavaScript?

JSON is stricter than JavaScript: keys need double quotes, strings cannot use single quotes, and trailing commas and comments are not allowed.

Does sorting keys change the data?

No. Object key order has no meaning in JSON. Sorting just makes two files easier to compare.

Can it handle large files?

Files of several megabytes are fine. Very large files depend on your device's memory.

Is my JSON sent anywhere?

No. Parsing and formatting happen in your browser.

Related news

Related tools