JSON Formatter

Beautify, validate and minify JSON instantly, entirely in your browser.

The JSON Formatter & Validator takes messy, minified or broken JSON and lets you beautify it with clean indentation, minify it into a single compact line, or validate it and see exactly where a syntax error is. It runs entirely in your browser using the native JSON.parse engine. Your data is never uploaded, so it is safe for API responses, config files and payloads that contain tokens or customer data.

How to use the JSON formatter

  1. Paste your JSON into the Input JSON box.
  2. Click Beautify for readable, indented output, Minify to strip all whitespace, or Validate to check the syntax only.
  3. If the JSON is invalid, the error message shows what went wrong and where.
  4. Click Copy result to copy the output to your clipboard.

What is JSON?

JSON (JavaScript Object Notation) is a lightweight text format for structured data, defined in RFC 8259 and ECMA-404. It is the standard format for REST APIs, many config files (package.json, tsconfig.json), NoSQL databases and logs. JSON has six value types:

TypeExample
Object{"name": "Asha", "age": 29}
Array[1, 2, 3]
String"Pune" (double quotes only)
Number42, -3.14, 1.5e3
Booleantrue, false
Nullnull

Beautified vs minified

Minified: {"id":101,"city":"Mumbai","tags":["sea","film"],"active":true}

Beautified:
{
  "id": 101,
  "city": "Mumbai",
  "tags": [
    "sea",
    "film"
  ],
  "active": true
}

Beautify when you are reading or debugging. Minify when you are sending data over the network or storing it, because it removes bytes that only humans need. With gzip on the wire, the size difference is usually small.

Most common JSON errors (and fixes)

ErrorInvalidValid
Single quotes{'a': 1}{"a": 1}
Unquoted keys{a: 1}{"a": 1}
Trailing comma[1, 2, 3,][1, 2, 3]
Comments{"a": 1 // note}Remove comments (or use JSONC/JSON5 tooling)
Undefined / NaN{"a": undefined}{"a": null}
Leading zeros{"pin": 0411}{"pin": "0411"} (use a string)
Unescaped characters"C:\new""C:\\new"
Missing comma{"a": 1 "b": 2}{"a": 1, "b": 2}

Error messages refer to a position (character index) or line. Look just before that point, because the real mistake is often a missing comma or quote on the previous line.

Gotchas developers hit

  • Big numbers: JavaScript numbers are 64-bit floats, so integers larger than 253 − 1 (9,007,199,254,740,991) lose precision when parsed. Send large IDs, such as some database or social-media IDs, as strings.
  • Duplicate keys are technically allowed but behave unpredictably. Most parsers keep the last value.
  • Dates have no JSON type. Use ISO 8601 strings ("2026-11-02T10:30:00Z") or Unix timestamps. See the Timestamp Converter.
  • Binary data can’t go into JSON directly. Encode it with Base64 using the Base64 tool.
  • Encoding: JSON exchanged between systems must be UTF-8. Hindi, Marathi and emoji work fine as-is or as \uXXXX escapes.

Privacy

Many online formatters send your text to a server. This one doesn’t. Parsing and formatting happen in JavaScript on your device, and nothing is logged or stored. You can confirm this by disconnecting from the internet after the page loads. The tool keeps working.

Frequently asked questions

How do I format JSON online?

Paste your JSON into the input box and click Beautify. The output is indented with 2 spaces and is easy to read. Click Copy result to copy it.

Why is my JSON invalid?

The most common causes are single quotes instead of double quotes, trailing commas, unquoted keys, comments and missing commas. The validator shows the position where parsing failed.

Is it safe to paste API keys or customer data here?

The tool runs entirely in your browser and never uploads your input. Still, follow your organisation’s policies and rotate any secret you suspect has been exposed.

What is the difference between minify and beautify?

Beautify adds line breaks and indentation for readability. Minify removes all unnecessary whitespace to make the JSON as small as possible for storage or transfer.

Does JSON support comments?

No. Standard JSON (RFC 8259) does not allow comments. Some tools accept JSONC or JSON5, which do, but a strict parser such as this one will reject them.