JSON Formatter & Validator | Beautify, Validate & Minify

Beautify, validate, and minify your JSON data instantly.

JSON Formatter & Validator

Report an Issue

Found a bug or have a suggestion for JSON Formatter & Validator | Beautify, Validate & Minify? Let us know!

Size: Lines:
SOURCE
RESULT
 

Waiting for data...

JSON Formatter & Validator

This tool parses JSON the moment you paste or type it, flags the first syntax error it finds with a line reference, and turns valid JSON into either a readable indented document or a compact single-line string. A stray comma or an unquoted key is caught immediately, instead of causing a silent failure somewhere downstream.

How the validator works

The text you provide is run through a parser that follows the RFC 8259 standard every time it changes. If parsing succeeds, the object is rewritten with two-space indentation for the formatted view, or with all whitespace removed for the minified view. If parsing fails, the process stops at the first structural problem it hits, a missing comma, an extra comma right before a closing bracket, a key without quotes, or a string closed with single quotes instead of double, and shows the parser actual error message instead of a generic invalid-JSON notice. Parsing and formatting both happen in the browser; the text never leaves the page. Beyond formatting, the result can be viewed as syntax-highlighted code, plain text, a collapsible tree, or an editable form, and the source or result can be filtered with a field/operator/value rule builder, a free-text search, or a JMESPath query. Uploading a .json file, downloading the result, and undo/redo history are also available, alongside a live byte-size and line-count readout.

Worked example

Take the object {"id": 4821, "name": "Ada Lovelace", "active": true,} - notice the comma right before the closing brace. A JSON parser treats that comma as a syntax error, because unlike JavaScript object literals, JSON does not allow a trailing comma after the last property. The tool reports the error at that exact position instead of accepting the file; removing the comma after true fixes it, and the object then formats cleanly with each key on its own line.

Before and after formatting

A typical API response arrives minified, all on one line. Formatting expands it for reading; minifying reverses the process for transport:

{"orderId":88213,"customer":"Ada Lovelace","city":"Cambridge","items":[{"sku":"BK-104","qty":2},{"sku":"BK-207","qty":1}],"total":57.4,"paid":true}
{
  "orderId": 88213,
  "customer": "Ada Lovelace",
  "city": "Cambridge",
  "items": [
    {
      "sku": "BK-104",
      "qty": 2
    },
    {
      "sku": "BK-207",
      "qty": 1
    }
  ],
  "total": 57.4,
  "paid": true
}

Frequently Asked Questions