# JSON Formatter and Validator

> Free JSON formatter and validator. Paste JSON to pretty-print it, minify it, validate it, count keys, and measure nesting depth. Everything runs in your browser; nothing is uploaded.

Paste JSON and pretty-print it with two-space indentation, minify it to one line, or validate it and see key counts and nesting depth. No uploads, everything runs in your browser.

*Interactive tool: enter your values at https://toollantern.win/json-formatter-validator/ and results update instantly in your browser.*

## What the tool does

Format indents your JSON with two spaces so it is easy to read. Minify strips all whitespace for compact storage or transmission. Validate checks the syntax and reports the number of keys and the maximum nesting depth.

## Worked example

Paste **{"name":"Ada","scores":[3,7,9]}** and click Format to get:

{
  "name": "Ada",
  "scores": [
    3,
    7,
    9
  ]
}

It has 2 top-level keys and a nesting depth of 3 (object, array, values).

## Your data stays private

All processing happens in your browser with JavaScript's JSON parser. Nothing is sent to any server, so you can safely format configuration files and API responses.

## Frequently asked questions
### What is valid JSON?

Valid JSON is text that follows the JSON syntax: quoted keys, double quotes on strings, no trailing commas, no comments, and a single root value.

### Why does my JSON fail to validate?

The most common errors are trailing commas, single quotes instead of double quotes, and unquoted keys. The error message points to the exact problem.

### What does nesting depth mean?

How many levels deep the data goes. A flat object has depth 1; an object containing an array of objects has depth 3.

### Is my data sent to a server?

No. Everything runs locally in your browser, so nothing you paste ever leaves your device.

---
Interactive version: https://toollantern.win/json-formatter-validator/
