How to use JSON Formatter & Validator
The JSON Formatter, Validator and Viewer parses raw JSON, pinpoints syntax errors down to the exact line and column, and reformats the output with 2 or 4-space indentation. Switch to the collapsible tree view to explore a large payload like a JSON viewer, or filter it with a JSONPath expression. Developers use it to inspect API responses, debug configuration files and verify a payload is valid before committing.
- Paste your JSON, or click Upload to load a .json file — nothing leaves your browser.
- Choose 2 or 4-space indentation, and optionally Sort keys.
- Click Format to see the prettified, colour-coded output, or an error with its exact line and column.
- Switch to the Tree view to explore nested data, or type a JSONPath filter to narrow it down.
- Copy the result or download it as a .json file.
Your data never leaves your device — 100% private processing.
Why JSON validation matters
A single misplaced comma or unquoted key causes an entire JSON document to be unparseable. Modern APIs return minified JSON that is impossible to read without formatting. Validators catch issues such as trailing commas (disallowed in JSON), single-quoted strings (only double quotes are valid), unescaped control characters and duplicate keys that silently overwrite earlier values.
JSON data types and structure
JSON supports six data types: string (double-quoted), number (integer or float), boolean (true/false), null, array (ordered list in square brackets) and object (key-value pairs in curly braces). Keys must be strings. Nested objects and arrays can go arbitrarily deep. The JSON Schema standard adds optional type validation and constraints on top of basic JSON structure.
| Type | Example | Notes |
|---|---|---|
| string | "hello" | Must use double quotes |
| number | 42 or 3.14 | No NaN or Infinity |
| boolean | true / false | Lowercase only |
| null | null | Represents absence of value |
| array | [1, 2, 3] | Ordered, mixed types allowed |
| object | {"key": "value"} | Unordered key-value pairs |
Worked examples
Pretty-print minified JSON
Inputs: {"a":1,"b":[2,3]}
Result: 2-space indented, 6 lines, keys aligned
Trailing comma flagged
Inputs: {"a":1,}
Result: Error: unexpected "}" — trailing comma not allowed in JSON
Minify back to one line
Inputs: formatted object across 6 lines
Result: {"a":1,"b":[2,3]}
Glossary
- JSON
- JavaScript Object Notation — a lightweight text format for data interchange.
- Minification
- Removing whitespace and newlines to reduce JSON file size for network transfer.
- Schema
- A JSON document that defines valid structure and data types for another JSON document.
- Serialization
- Converting a data structure to a string representation for storage or transmission.
- Pretty-print
- Reformatting JSON with indentation and newlines for human readability.
Related reading
Frequently Asked Questions
Why use JSON Formatter & Validator?
- Pretty-print minified JSON with 2 or 4-space indentation, or sort keys for diff-friendly output
- Validate JSON and jump to the exact line and column of a parse error
- Explore nested data in a collapsible tree view — a built-in JSON viewer, no upload
- Filter deep structures with a JSONPath expression such as $.users[*].name
- Upload a .json file or paste it; copy or download the formatted result
Common use cases
- Debug a malformed API response by reformatting it into readable structure
- Browse a large nested JSON document in the tree view instead of scrolling raw text
- Extract just the fields you need from a big payload with a JSONPath filter
- Clean up a copied JSON blob before committing it to a config file
- Identify a trailing comma error in a hand-edited JSON config by its line and column
Get weekly tool tips & updates
New tools, power-user tips, and productivity hacks — delivered free every Friday.
No spam, ever. Unsubscribe with one click.
Related Developer Tools
Base64 Encoder & Decoder
Encode text or files to Base64, or decode Base64 strings back to text in seconds. Free, private, and fully in-browser now.
Password Generator
Generate strong, secure, random passwords instantly. Uses the Web Crypto API — nothing is sent to any server, so your passwords stay private.
Regex Tester
Test and debug regular expressions online. See live matches, capture groups, and replace output. Free, private, instant.
URL Encoder / Decoder
Encode and decode URLs and URL components online. Convert special characters to percent-encoding and back instantly — free, private, and fast.
HTML Encoder / Decoder
Encode and decode HTML entities online. Escape <, >, &, and quote characters for safe HTML display. Free, instant, and private — runs in your browser.
Hash Generator
Generate SHA-1, SHA-256, SHA-384, and SHA-512 hashes instantly in your browser. Free, private, and secure for quick checks.
Explore all Developer Tools.