JSON Formatter & Validator
Beautify, validate and minify JSON quickly and easily. Free, private, runs in your browser.
Formatted JSON will appear here…
What Is JSON?
JSON (JavaScript Object Notation) is a lightweight text format for storing and transporting data. It was derived from JavaScript but is now language-independent — every major programming language can read and write JSON. JSON has become the dominant data format for web APIs, configuration files, and data storage because it is easy for humans to read and easy for machines to parse.
A JSON document is built from two structures: objects (key-value pairs wrapped in curly braces {}) and arrays (ordered lists wrapped in square brackets []). These two structures can be nested inside each other to represent virtually any data shape.
JSON Data Types
JSON supports exactly six value types:
- String — text in double quotes:
"hello world" - Number — integers or decimals:
42,3.14 - Boolean —
trueorfalse(lowercase, no quotes) - Null —
null(lowercase, represents no value) - Object — key-value pairs:
{"name": "Alice", "age": 30} - Array — ordered list:
["red", "green", "blue"]
All keys in a JSON object must be strings in double quotes. Single quotes are not valid JSON — this is the most common mistake beginners make.
JSON Format Rules
Valid JSON must follow these rules exactly:
- Keys must be wrapped in double quotes (not single quotes)
- Strings must use double quotes
- No trailing commas after the last item in an object or array
- No comments (JSON does not support
//or/* */) - Boolean and null values must be lowercase (
true,false,null) - Numbers cannot start with a leading zero (use
5not05)
Advanced JSON Formatter with Syntax Highlighting
Paste your raw or minified JSON into the Input box, choose an indentation style, then click Beautify. The output is colour-coded: keys in blue, strings in green, numbers in orange, booleans in purple, and null in red — making complex structures far easier to read at a glance.
Find, Replace & Filter
Use Find to search for any text in the formatted output, with match navigation (‹ ›). Replace and Replace All modify the raw input. The Filter Keys bar lets you narrow the output to only show top-level properties matching a comma-separated list of key names.
Common JSON Errors and How to Fix Them
| Error | Cause | Fix |
|---|---|---|
| Unexpected token | Trailing comma after last item | Remove the comma before } or ] |
| Unexpected end of input | Missing closing bracket | Add the missing } or ] |
| Unterminated string | Unescaped quote inside a string | Escape with \" |
| Expected property name | Keys not in double quotes | Change 'key' to "key" |
Beautify vs Minify — When to Use Each
Beautify adds indentation and line breaks — use it when reviewing API responses or editing config files. Minify removes all whitespace — use it before including JSON in production code or API requests where bandwidth matters.
JSON vs XML
JSON has largely replaced XML for web APIs because it is more compact and easier to read. A JSON object {"name":"Alice","age":30} takes far fewer characters than the equivalent XML <person><name>Alice</name><age>30</age></person>. XML still has advantages for document-centric data (it supports attributes, namespaces, and comments), but for API data exchange, JSON is the modern standard.