JSON Formatter and Validator

Paste JSON, choose how to indent it and see at once whether it is valid. An error shows the line and column where the problem starts. Nothing you paste leaves your browser.

Free Runs in your browser Checked Tuesday, November 10, 2026

The JSON to check, up to 2,000,000 characters. Numbers and strings are kept exactly as typed.

Sorts the names inside every object, at every level. The order of array items stays the same.

Result

Validity — Valid JSON, or the line and column of the first error.
Names (keys) — How many names there are in all the objects together.
Nesting depth — How many objects and arrays are nested inside each other, at most.
Formatted JSON

This tool runs in your browser. What you enter is not sent to us.

How to use it

  1. Paste your JSON into JSON text. The result is checked as you type.
  2. Choose an Indentation, or No spaces (minified) to make the text as short as possible.
  3. Tick Sort keys A to Z if you want the names in each object in alphabetical order.
  4. Read Validity. If it names a line and column, fix the text there. When it says valid JSON, copy the Formatted JSON.

How the JSON is checked and formatted

JSON is defined by RFC 8259. A text is valid when it holds one value, usually an object or an array, and every name is in double quotes. The tool asks the browser's own JSON parser whether the text is valid, so a valid result means what it means in your programs.

When the text is valid, the tool reads it again and writes it out with the indentation you chose. Only the spaces, tabs and line breaks between the tokens change. Names, strings and numbers are written exactly as you typed them.

  • Two spaces, four spaces and a tab make the nesting easy to read. Empty objects and arrays stay on one line as {} and [].
  • No spaces (minified) removes every space and line break, which makes the text shorter for a request or a settings value.
  • Sort keys A to Z changes the order of the names inside each object. It never changes the order of the items in an array, because that order is part of the data.

What is kept, and what the errors mean

Numbers are not rounded. A value such as 12345678901234567890 or 1.50 is written back as you typed it. Many programs read a number that long with less precision, which is why the original text is kept.

The position in an error is the first character where the text stops being JSON. A comma after the last item, a single quote where a double quote belongs and a missing comma between two items are the most common causes. The tool does not repair the text: it shows where the problem is and leaves your text unchanged.

Worked example: the default JSON

The default text is one object with five names. The list inside it is one level deeper, so the nesting depth is 2. The validity check says Valid JSON, and the formatted text uses two spaces for each level.

With Sort keys A to Z ticked, the same five names come out as free, license, name, tags and version. The list of tags keeps its order: json, csv, yaml.

Result Default text With Sort keys A to Z
Validity Valid JSON Valid JSON
Names (keys) 5 5
Nesting depth 2 2

Frequently asked questions

What is the difference between formatting and validating JSON?

Validating checks that the text follows the JSON grammar. Formatting changes only the spaces and line breaks, so the data stays the same. This tool does both, and an invalid text is never formatted.

Why does the tool show a line and a column?

They point to the first character that breaks the JSON grammar, counted from 1. Chrome and Firefox usually give that position in their error message. When a browser gives none, the tool finds the position itself.

Does the formatter change my numbers or my strings?

No. Numbers and strings are written exactly as you typed them, so a long ID such as 12345678901234567890 keeps every digit. Only the spaces and line breaks around them change.

Is my JSON sent to a server?

No. The check and the formatting run in your browser. Nothing you paste is sent to our server or stored there.

Why is a comma after the last item an error?

JSON does not allow a comma after the last item of an object or an array, although many programming languages do. Remove the comma that comes just before the closing bracket or brace.

Can the tool fix invalid JSON for me?

No. It reports the first problem and leaves your text unchanged, because a repair could guess the wrong meaning. Correct the text at the position shown, then check it again.

Sources

Figures and text last checked on Tuesday, November 10, 2026.

We use necessary cookies to run the site. With your consent, Google also uses advertising cookies to show personalised ads. If you reject them, you still see ads, but they are not personalised.