JSON Formatter & Validator
Format, validate, and minify JSON. Errors point to the exact line and column.
JSON input
Output
Paste JSON or load an example
Formatting runs in your browser. Nothing is uploaded.
More examples
Formatting Minified JSON
Input:
{"name":"Alice","age":30,"city":"New York"}
Output:
{
"name": "Alice",
"age": 30,
"city": "New York"
}Converts a compact, single-line JSON string into a human-readable format with indentation.
Validating and Formatting Complex JSON
Input:
[ { "id": 1, "items": [ "apple", "banana" ] }, { "id": 2, "active": true, "config": null } ]
Output:
[
{
"id": 1,
"items": [
"apple",
"banana"
]
},
{
"id": 2,
"active": true,
"config": null
}
]Formats nested arrays and objects with consistent indentation, handling different data types (number, string, boolean, null).
Detecting Syntax Errors
Input:
{
"name": "Bob",
"age": 40 // Missing comma
"isStudent": false
}The tool will identify the missing comma after the 'age' field and report a validation error.
About this tool
Paste JSON and the formatter validates it, then renders it in the mode you choose: Pretty with an indent you set — 2 spaces by default or a custom width — or Compact, which minifies everything onto a single line for production payloads. When parsing fails, the error message is matched to a line and column so you can jump straight to the offending character.
Statistics update on every run: counts of objects, arrays, strings, numbers, booleans and nulls, the maximum nesting depth, and the formatted output's character, line and byte size. Beyond formatting there is a tree view for exploring structure, JSONPath queries for pulling matching values, text search with highlighting, and a compare pane that diffs your JSON against a second copy.
The tool accepts strict JSON only: comments, trailing commas, single-quoted strings and unquoted keys are rejected exactly as a production parser would reject them. All parsing and analysis happen in your browser, so API responses containing real data stay on your machine.
How to use this tool
Paste or upload
Paste JSON into the editor, upload a .json file, or start from one of the bundled samples.
Choose a mode
Pick Pretty for readability — adjusting the indent width if needed — or Compact to minify.
Fix reported errors
If validation fails, use the reported line and column to locate the syntax problem, correct it, and run the formatter again.
Inspect the result
Read the statistics, browse the tree view, run a JSONPath query, then copy or download the formatted output.
Frequently asked questions
Why is my JSON invalid?
The usual culprits are a trailing comma before a closing bracket, single quotes around strings, comments, unquoted keys, or bare constants such as NaN. The JSON grammar allows none of these, and the validator reports the first position that breaks it.
Can it minify JSON as well?
Yes. Select the Compact mode and the output collapses to one line with no unnecessary whitespace — handy for shrinking configuration files or payloads before shipping them.
Does it support comments (JSONC)?
No. Validation follows the strict JSON specification, so JSONC annotations must be stripped first; otherwise the parser reports them as syntax errors just like any runtime would.
Is my JSON uploaded anywhere?
No. Parsing, formatting, statistics and comparisons all run in your browser with the standard JavaScript engine, and nothing is transmitted to a server.
Related guides
Structural JSON Diffing: Why Path-Addressed Beats Line-by-Line
A line diff sees 5432 becoming "5432" as one quote — a structural diff flags it as a type change. Path-addressed operations and LCS matching, in your browser.
TOML vs YAML vs JSON: Choosing the Right Config Format
Why Rust and Python both settled on TOML, what each format actually gives you, and how to validate your Cargo.toml without guessing.
Validating JSON Against a Schema: A Practical Guide to JSON Schema
What JSON Schema guarantees, how draft-07 works, and how instance paths identify fields that are missing, malformed, or the wrong type.
JSON Lines (NDJSON): Streaming JSON for Logs, Pipelines and LLMs
What makes one-object-per-line files different from JSON arrays, when NDJSON shines, and how to work with it in any language.
Related tools
JSON to CSV Converter
Convert JSON arrays into CSV with nested-object flattening, delimiter choice, formula neutralization and spreadsheet-safe quoting.
JSON ⇄ YAML Converter
Bidirectional JSON/YAML conversion with advanced formatting options, auto-detection, file upload, and comprehensive statistics
GraphQL Formatter & Validator
Format, validate and beautify GraphQL queries with syntax highlighting
Diff Checker
Compare two text blocks and highlight differences side-by-side