JSON Formatter & Validator
Format, validate and explore JSON instantly. Pretty-print or minify with line-numbered error highlighting, collapse/expand the interactive tree view, run JSONPath queries, and convert to YAML — all 100% client-side.
JSON Formatter and Validator Tool
Rate this tool
JSONPath query and interactive tree view — features most free JSON formatters skip
Most free JSON formatters do one thing: pretty-print. This tool adds an interactive collapsible tree explorer, a JSONPath query engine to extract values from nested JSON without code, JSON-to-YAML conversion, and exact error locations with line and column numbers.
How to format and validate JSON online
How this compares to other JSON formatters
| Feature | LazyTools | JSONLint | jsonformatter.org | JSON Editor Online |
|---|---|---|---|---|
| Format / pretty-print | Yes | Yes | Yes | Yes |
| Validate with line numbers | Yes — line & column | Yes | Yes | Yes |
| Minify to one line | Yes | Yes | Yes | Yes |
| Interactive tree view | Yes — collapse/expand | No | No | Yes |
| JSONPath query | Yes | No | No | Partial |
| JSON to YAML | Yes — same page | No | Separate page | No |
| File upload | Yes | No | Yes | Yes |
| 100% client-side | Yes | Yes | No — server | Yes |
JSONPath syntax quick reference
| Expression | Syntax | What it selects |
|---|---|---|
| Root | $ | The entire document |
| Child | $.user | The "user" property at root level |
| Nested child | $.user.name | The "name" inside the "user" object |
| Array index | $.items[0] | The first element of the "items" array |
| All array elements | $.items[*] | Every element in the "items" array |
| Recursive descent | $..name | All "name" properties anywhere in the document |
| Recursive descent array | $..id | All "id" values at any depth |
| Nested array property | $.users[*].email | The "email" of every user in the array |
| Multiple levels | $.data.items[*].id | IDs from items nested inside data |
JSON Formatter & Validator — A Complete Guide for Developers
JSON (JavaScript Object Notation) is the backbone of modern web APIs, configuration files and data interchange. But raw JSON — especially from API responses — is often minified into a single unreadable line, or contains syntax errors that are invisible to the naked eye. A good JSON formatter does more than just add whitespace: it validates the structure, highlights errors precisely, and gives you tools to explore and extract data from complex nested documents.
Free online JSON formatter and validator
The difference between a basic formatter and a useful one is the error message. "Invalid JSON" tells you nothing. "Unexpected token at line 14, column 23" tells you exactly where to look. Common JSON errors include trailing commas after the last item in an object or array (not valid in JSON, though valid in JavaScript), single-quoted strings (JSON requires double quotes), unquoted keys, and missing commas between properties. This formatter identifies all of these and shows the exact position, so you can fix the error in seconds rather than scanning hundreds of lines.
JSON beautifier and minifier tool
Beautifying JSON means adding consistent indentation and newlines to make the structure readable to humans. A two-space indent is the most common convention and produces compact output. A four-space indent is easier to read for deeply nested structures. Tab indentation is preferred in some codebases where tab width is configurable in the editor. Minifying JSON strips all whitespace to produce the smallest possible file, which reduces HTTP payload size and speeds up API response transmission. The two operations are inverse: beautify for humans, minify for machines.
JSON tree viewer online free
An interactive tree view transforms nested JSON into a visual hierarchy that you can expand and collapse at any level. This is particularly useful for large API responses where the top-level structure is clear but you need to navigate into specific sections. Collapsing a subtree hides all its children so you can focus on adjacent sections. Hovering a value reveals a copy button, letting you extract just the value you need without selecting text manually. Type badges (string, number, boolean, null, array, object) show the data type at a glance without reading the raw JSON syntax.
JSONPath query tool online
JSONPath is a query language for JSON, analogous to XPath for XML. The $ symbol represents the root of the document. Dot notation ($.user.name) navigates to a specific property. The [*] wildcard selects all elements of an array. The double-dot operator (..) performs a recursive descent, matching the named property at any depth in the document. This is powerful for finding all instances of a key in a deeply nested structure — for example, $..id finds every "id" field regardless of nesting level. JSONPath eliminates the need to write a loop in code just to extract a list of values from an API response.
JSON to YAML converter free online
YAML (YAML Ain't Markup Language) is a superset of JSON that uses indentation rather than braces and brackets to represent structure. It is the dominant config format for Kubernetes manifests, GitHub Actions workflows, Docker Compose files, Helm charts and many other DevOps tools. Converting JSON to YAML preserves all the data exactly but produces a format that is easier for humans to write and review in version control. Multiline strings become block scalars. Booleans and numbers remain unquoted. Keys that contain special characters are quoted. This converter handles all these edge cases correctly.