Skip to content
ToolHub

JSON Formatter

Format JSON with 2 spaces, 4 spaces or tabs, and see errors instantly.

J{}
JSON Tools Pro
12 tools ยท Live ยท Same Pattern
๐ŸงฉResult
โ€”
Paste JSON to start
โšก Output
โ€”
History0

About the JSON Formatter

The JSON Formatter re-indents JSON so it is easy to read. Paste a compact API response or config file, choose 2 spaces, 4 spaces or tabs, and copy the formatted result. If the input is not valid JSON, the parserโ€™s error message tells you what went wrong.

How to use the JSON Formatter

  1. Paste your JSON.
  2. Choose the indentation.
  3. Copy the formatted output, or read the error message if parsing fails.

Example

Before and after

{"id":7,"tags":["a","b"]} becomes:

{
  "id": 7,
  "tags": [
    "a",
    "b"
  ]
}

JSON syntax rules

  • Keys must be strings in double quotes: {"name": "Ali"}.
  • Strings use double quotes, never single quotes.
  • Values can be a string, number, true, false, null, an object or an array.
  • Items are separated by commas, with no comma after the last item.
  • Comments are not allowed.

Common JSON errors and fixes

ErrorInvalidValid
Trailing comma[1, 2, 3,][1, 2, 3]
Single quotes{'a': 1}{"a": 1}
Unquoted key{a: 1}{"a": 1}
Comment{"a": 1 // id}{"a": 1}
NaN or undefined{"a": NaN}{"a": null}

To check syntax only, use the JSON Validator; to compare two documents, the JSON Diff; to turn JSON into a spreadsheet, JSON to CSV.

Frequently asked questions

Does formatting change my data?

No. Only whitespace changes. Keys keep their order and values are untouched.

Why does it say my JSON is invalid?

Common causes are trailing commas, single quotes instead of double quotes, comments and unquoted keys. JSON does not allow any of them.

Is my JSON sent anywhere?

No. Parsing and formatting happen in your browser.

Use โ†‘ โ†“ to move, Enter to open.