Skip to content
Free data tool

JSON formatter

This JSON formatter checks that your JSON is valid and rewrites it with clean, readable indentation. Developers, analysts and students use it to read API responses, fix config files and find the exact spot where a JSON document breaks.

  • Runs in your browser
  • Free, no account needed
  • Copy or download the result

Your input

170 characters

Result

{
  "order": 1042,
  "customer": {
    "name": "Ada Lovelace",
    "email": "ada@example.com"
  },
  "items": [
    {
      "sku": "TEA-01",
      "qty": 2,
      "price": 4.5
    },
    {
      "sku": "MUG-02",
      "qty": 1,
      "price": 12
    }
  ],
  "paid": true
}

The short answer

JSON is valid when it is one value built from objects, arrays, strings, numbers, true, false and null, with double-quoted keys and no trailing commas or comments. Formatting changes only the whitespace, never the data. When an error shows a position, look for a missing comma, quote or bracket just before it.

FormulaA JSON document is one value: an object {"key": value}, an array [value, value], a double-quoted string, a number, true, false or null

Worked exampleThe compact order record with 2-space indentation gets each nested field on its own indented line, so the customer name and email and the two items (TEA-01 and MUG-02) are easy to read, and the data is unchanged.

Example

Input
{"order":1042,"customer":{"name":"Ada Lovelace","email":"ada@example.com"},"items":[{"sku":"TEA-01","qty":2,"price":4.5},{"sku":"MUG-02","qty":1,"price":12}],"paid":true}
Result
{
  "order": 1042,
  "customer": {
    "name": "Ada Lovelace",
    "email": "ada@example.com"
  },
  "items": [
    {
      "sku": "TEA-01",
      "qty": 2,
      "price": 4.5
    },
    {
      "sku": "MUG-02",
      "qty": 1,
      "price": 12
    }
  ],
  "paid": true
}

How to use the json formatter

  1. Paste your JSON into the JSON box.
  2. Pick an Indentation option: 2 spaces, 4 spaces, Tabs or Compact.
  3. The formatted JSON appears as you type. Press Run any time to check it again.
  4. Press Copy result, or Download to save it as a text file.

How it works

Compact removes every extra space and line break, so it also works as a JSON minifier.

Strict JSON rules apply. Comments, trailing commas and single-quoted strings are rejected, and the error names the character position to check.

Duplicate keys in the same object are rejected instead of silently keeping one value. The keys __proto__, prototype and constructor are rejected too.

Integers above 9007199254740991, or numbers with more digits than JavaScript can store exactly, are rejected so they are not changed by accident. Put them in quotes to keep them as text.

Numbers are written in their shortest form, so 1.50 becomes 1.5. Nesting deeper than 100 levels or more than 100,000 values is rejected.

Everything runs in your browser. Your input is not uploaded or stored. If you use Copy link, what you entered is placed in the link.

Questions and answers

How do I format JSON online?

Paste the JSON into the box and choose an indentation. The formatted result appears below as you type, ready to copy or download.

Why does my JSON show an error?

The tool follows the strict JSON standard. Common causes are trailing commas, comments, single quotes or a missing quote, and the message tells you which character to look at.

Can it minify JSON?

Yes. Choose Compact in the Indentation menu to get the same data on one line with no extra spaces.

Is my JSON uploaded to a server?

No. The formatter runs in your browser, and your input is not sent anywhere.

Last updated November 1, 2026. Maintained by SnowRock. How our tools work

All 220 SnowRock tools