Skip to content
ScriptGarden

JSON Formatter and Validator

Paste JSON to format it with indentation, minify it, sort its keys or check that it is valid. Errors show the line and column.

Runs in your browserFreeNo sign-upUpdated

What is JSON?

JSON (JavaScript Object Notation) is a plain-text format for storing and sending structured data as named values and lists. A formatter adds line breaks and indentation so it is easy to read, and a validator tells you exactly where the syntax breaks.

How it works

  1. 1

    Paste your JSON into the box.

  2. 2

    Choose the indent size and whether to sort keys.

  3. 3

    Press Format, Minify or Validate.

  4. 4

    Copy or download the result, or fix the error shown.

Frequently asked questions

Why is my JSON invalid?

The most common causes are a trailing comma after the last item, single quotes instead of double quotes, keys without quotes, comments, and missing commas or brackets. The error message shows the line and column of the first problem.

Does the tool fix errors for me?

No. It points to where the problem is so you can correct it. Guessing at fixes can silently change your data.

Is my data private?

Yes. Parsing and formatting happen in your browser and nothing is uploaded.

What is the difference between format and minify?

Format adds indentation and line breaks for people to read. Minify removes all unneeded whitespace to make the smallest file for machines.

Is it safe to sort keys?

The JSON standard treats the order of keys in an object as not meaningful, so sorting is safe for most uses. A few programs do depend on the order, so keep a copy if unsure.

Can it handle very large numbers?

Numbers beyond about 9 quadrillion (2 to the power 53) lose precision when read by JavaScript, which this tool uses. If exact big numbers matter, store them as strings.

Sources and further reading

More free tools