Skip to content

JSON formatter and validator

Validate, beautify, minify and query JSON.

DeveloperRuns in your browser

Valid JSON
{
  "user": {
    "id": 123,
    "name": "Ada",
    "roles": [
      "admin",
      "editor"
    ]
  },
  "active": true
}
Objects
2
Arrays
1
Values
5

Supports $, .property and [index]. Example: $.items[0].price

{
  "user": {
    "id": 123,
    "name": "Ada",
    "roles": [
      "admin",
      "editor"
    ]
  },
  "active": true
}

This online JSON formatter validates syntax, pretty-prints or minifies any JSON, and tells you the exact line and column when something is wrong. It's the tool you reach for when debugging an API response, reviewing a config file, or turning a single-line JSON blob into something readable.

Everything runs in your browser: your JSON is never sent to a server, so you can safely paste payloads with customer data or test credentials without them ever leaving your machine.

How to use

  1. 1Paste your JSON into the input box.
  2. 2If there is a syntax error, the tool points to the exact line and column.
  3. 3Choose pretty print or minify, the indent size (2, 4 or 8 spaces) and whether to sort keys alphabetically.
  4. 4If you only need one value, pull it out with a basic JSONPath such as $.items[0].id.
  5. 5Copy the result, download it as .json, or save it to your history.

What you can do

  • Syntax validation with error details
  • Pretty print and minify
  • JSONPath value extraction
  • Alphabetical key sorting

Why validate and format JSON

One extra comma, a stray single quote or an unclosed brace breaks any program trying to read that JSON. Spotting that by eye in a few hundred lines is nearly impossible; with the exact line and column, you fix it in seconds.

  • Debug API responses before wiring them into your code.
  • Review configuration files (package.json, tsconfig, etc.).
  • Turn a minified JSON blob into something you can actually read.
  • Diff two versions of the same JSON with keys sorted the same way.

Pretty print vs. minify

Pretty printing adds indentation and line breaks so a person can read the structure at a glance — what you want while developing or reviewing data. Minifying does the opposite: it strips every unnecessary space so the file is smaller, which matters when the JSON travels over the network or sits in a size-limited log.

Neither option changes the data itself, only how it looks. The decoded content is exactly the same either way.

Pulling out a value with basic JSONPath

When the JSON is large and you only care about one field, you don't need to read the whole thing: a path like $.user.name or $.items[2].price jumps straight to that value. This tool supports dotted property access and bracketed array indexes, which covers most real-world cases without the complexity of a full query engine.

  • $ stands for the whole JSON document.
  • $.property enters an object by its key.
  • $.list[0] enters an array by position (0-based).
  • Paths can be chained: $.order.items[1].sku.

Frequently asked questions

What does a JSON formatter actually do?

It checks that the text follows JSON grammar (double quotes, no trailing commas, balanced braces and brackets) and, if it's valid, rewrites it with readable indentation or minifies it by stripping whitespace. If it's invalid, it points to exactly where the first problem is.

What's the difference between pretty print and minify?

Pretty printing adds indentation and line breaks so the JSON is easy to read. Minifying removes that whitespace to shrink the file size. Either way, the underlying data never changes — only its presentation does.

How do I know which line my JSON error is on?

As soon as the JSON is invalid, the tool shows the exact line and column where it found the problem, along with a short description of what it expected there (a comma, a quote, a property name...).

What is JSONPath and how do I use it here?

JSONPath is a way to point at a specific part of a JSON document, similar to a folder path. This tool supports the basic form: $ for the root, .property to enter an object, and [n] for an array position — for example $.items[0].id.

What's the point of sorting keys alphabetically?

It makes it easier to diff two versions of the same JSON (say, between a dev and a production environment): with keys always in the same order, a plain text diff only flags real changes instead of harmless reordering.

Is my JSON sent to a server?

No. Parsing, formatting and JSONPath extraction all run in your browser. It's only stored if you're signed in and choose to save the result to your history, and you can delete it at any time.

More in Developer