moim.bio

JSON Formatter

Unfold JSON crammed onto one line into something readable. Syntax errors are pinned to a line and column.

Formatting is a syntax check

If it formatted, the JSON is valid. If it did not, you get the line and the column plus an arrow pointing at the spot. Even for 30,000 characters crammed onto a single line, only the text around the problem is shown, so you can actually find it.

What people get wrong in JSON

Not allowedWhy
{'a': 1}Keys and strings take double quotes only
{"a": 1,}A trailing comma after the last item is not permitted
{a: 1}Keys need quotes too — this is not a JavaScript object literal
// commentJSON has no comments
{"a": undefined}undefined is not a JSON value. Use null
{"a": .5}The zero before the decimal point cannot be dropped

The trailing comma beats all the others put together, because JavaScript and Python both allow it and JSON alone does not.

The shape at a glance

Under the output box you get counts of objects, arrays and keys, plus the nesting depth. It is what you want the first time an API response lands in front of you: how big is this, and how far down do I have to dig.

Sorting keys

Turn on sort keys alphabetically and object keys come back in order. It is useful when diffing two API responses — if only the key order differed, the diff goes empty. Arrays are left alone, because in an array the order is the data.

Will non-ASCII text come out as \u escapes?

No. Characters are kept as they are. Even input that arrived escaped — the default from Python's json.dumps, for instance — is shown here as readable text.

Does it handle large files?

Up to 16 MB. Be aware that formatting a JSON file of several megabytes can freeze the tab for a moment.

23 more tools