Yuzool

Dev Tools

JSON formatter and validator

Paste JSON to format it with 2 or 4 spaces or tabs, minify it, or explore it as a tree. If it’s broken, you get the line and column of the first mistake and a plain reason.

The mistakes that break JSON

JSON is stricter than JavaScript. These are the errors people hit most, with what this page says about each one (checked by its own validator):

JSONWhat’s wrong
{"a": 1,}A comma before } (trailing commas aren’t allowed in JSON)
{'a': 1}Keys need double quotes, not single quotes
{a: 1}Expected a key in double quotes, found "a"
[1, 2The text ends before this list is closed with ]
{"a": undefined}undefined isn’t allowed in JSON
{"a": 01}Numbers can’t start with 0 or have a second decimal point
{"a": 1} // noteMore after the end of the JSON: "/"

Fix the first error and check again: one missing comma or bracket can make every line after it look wrong.

Format, minify or explore

Format adds line breaks and indents so you can read it; Minify removes every space that isn’t inside a string, for the smallest file. Sort keys orders every object’s keys from A to Z, which makes two versions of a file easier to compare. Tree shows the structure: tap any key to see its path, then Query it.

JSONPath in one minute

Type a path in the query box to pull out just the part you need. A path starts at $ (the whole document):

PathMeans
$.order.idthe id inside order
$.items[0]the first item
$.items[-1]the last item
$.items[*].skuthe sku of every item
$..priceevery price, at any depth
$.items[0:2]the first two items

How to use it

  1. Paste JSON, or open or drop a .json file.
  2. Pick Format, Tree or Minify, and the indent.
  3. Copy or download the result. A red line under the input means it isn’t valid JSON yet: press Show me to jump to the mistake.

Questions

Is my JSON uploaded?

No. It’s formatted and checked in your browser, on your device. Nothing you paste is sent anywhere, so it’s safe for API responses and config files with private data.

How big a file can it format?

Tens of megabytes work in a desktop browser. The tree shows 200 items at a time in long lists, with a button for more, so big files stay quick.

Why does it say my JSON has a trailing comma?

JSON doesn’t allow a comma after the last item in an object or list, though JavaScript does. Delete the comma before the } or ].

Can it fix my JSON automatically?

No: it points to the exact line and column and says what’s wrong, so you can fix it knowing what changed.

Related tools

Open all 35 Dev Tools. Everything runs in your browser; nothing you paste is uploaded.

Settings

History

Snippet