DATA TOOLS

JSON formatter and validator

Paste JSON to check it, tidy it or shrink it. Your data is parsed in your browser and never leaves your device.

{ } / JSON workbench

Waiting for JSON. Checking happens as you type.

Result

The formatted result appears here.

How to format and validate JSON

  1. Paste your JSON, or open a .json file from your device.
  2. If something is wrong, the message names the line and column and says what to change. “Go to the error” puts the cursor there.
  3. Choose a layout: 2 or 4 spaces, tabs, or minified. Explore the tree, or copy or download the result.

Common JSON errors

Trailing comma
A comma after the last item, as in [1, 2,]. JavaScript allows it; JSON does not. Remove the last comma.
Single quotes
JSON strings and keys must use double quotes: "name", not 'name'.
Unquoted keys
Every key needs double quotes: {"id": 1}, not {id: 1}.
Comments
JSON has no comment syntax. Remove // and /* */ comments before parsing.
undefined, NaN, True or None
Only true, false and null are allowed, in lower case. Values from JavaScript or Python need converting.
Missing comma
Two entries with nothing between them, often after pasting a new line into a list.

Formatting, minifying and sorting

Formatting adds line breaks and indentation so the structure is easy to read. Minifying removes every optional space to make the smallest valid file, which is what you want when sending JSON over a network. Sorting keys puts each object’s keys in alphabetical order, which makes two versions of the same data easier to compare; array order is never changed.

What about very large numbers and repeated keys?

JSON allows numbers of any size, but browsers keep whole numbers exactly only up to 9,007,199,254,740,991. If your data has a larger one, such as a long ID, this page warns you before the value changes. It also warns when an object lists the same key twice, since only the last value survives.

Is my JSON uploaded?

No. Parsing and formatting run in your browser tab. Your JSON is not sent to a server or stored, and this page loads no ads.

Related tools

Comparing two versions? Sort keys here, then use the diff checker. For encoding, see the Base64 tools, or browse all utilities.