💻 Web Dev Tools

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.

Format & validate with line errors Interactive tree view JSONPath query JSON to YAML · 100% client-side
AdSense — 728×90 Leaderboard

JSON Formatter and Validator Tool

Input JSON
0 chars
Paste JSON and click Format
Formatted output
AdSense — 728×90 Leaderboard
📊
Need to convert your JSON to a spreadsheet?
The free JSON to CSV Converter handles nested objects with dot-notation flattening, supports comma/semicolon/tab delimiters for European Excel, and shows a live table preview before you download. One-click back to JSON too.
📊 JSON to CSV →
⭐ User Ratings

Rate this tool

4.9
Based on 48,291 ratings
5
43,944
4
2,897
3
966
4
242
1
242
Was this JSON formatter helpful?
Thank you for your rating!
Features

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.

Format, validate & minify
Pretty-print JSON with 2-space, 4-space or tab indent. Minify to a single line for API payloads and storage. Validation catches every syntax error with the exact line and column number — not just "invalid JSON". Instant on every keystroke or click.
🌳
Interactive tree view
Explore nested JSON in a collapsible tree. Click any node to expand or collapse it. Hover any value to reveal a copy button that copies just that value. Type badges show string, number, boolean, null, object and array at a glance. Expand all / Collapse all for large JSON.
🔍
JSONPath query engine
Run JSONPath expressions against any JSON document to extract values without writing code. Supports $ (root), dot notation ($.user.name), bracket notation, recursive descent (..), array wildcards ([*]), and index access ([0]). Results shown as a formatted JSON array. Absent on most free tools.
📂
JSON to YAML conversion
Convert any valid JSON to YAML with correct indentation, quoted strings where needed, and multi-line block scalars. Useful for Kubernetes manifests, GitHub Actions config, Helm charts and any system that uses YAML as the primary config format.
📍
Exact error locations
When JSON is invalid, the error panel shows the exact message with line number and column. Common error types (trailing commas, unquoted keys, single quotes, missing commas) are identified specifically — not just a generic parse failure. Lets you fix errors in seconds.
🔒
100% client-side & private
All processing happens in your browser using JavaScript. Your JSON never leaves your device. Safe for internal API responses, confidential config files, authentication tokens and any sensitive data. The tool works offline after the first page load.
How to use

How to format and validate JSON online

1
Paste or upload your JSON
Paste raw JSON into the input area, or click Upload to select a .json file. The input accepts any valid JSON: objects, arrays, nested structures, or a single value. If your JSON is already minified into one line, Format will expand it with proper indentation so you can read it.
2
Click Format or Validate
Format pretty-prints the JSON into the right panel with the selected indent size and shows a character count, key count and depth. Validate checks syntax without reformatting and shows the result in the status bar. Any error shows the exact line and column number in the error panel below the input.
3
Explore in tree view (optional)
Switch to the Tree View tab to see the JSON as an interactive collapsible tree. Click any node arrow to collapse or expand it. Hover any value line to see a copy button appear — click it to copy just that value to your clipboard. Use Expand all / Collapse all for quick navigation of large structures.
4
Run a JSONPath query (optional)
Switch to the JSONPath Query tab. Paste your JSON, type a JSONPath expression in the input bar, and click Run. The result is shown as a formatted JSON array of matched values. Click any example expression button to see how the syntax works. Useful for extracting nested values from complex API responses.
5
Copy, download or convert
Click Copy to copy the formatted or minified JSON to your clipboard. Click Download to save a .json file. To convert to YAML, switch to the JSON to YAML tab and the conversion happens automatically. Copy YAML to clipboard and paste directly into any YAML-based config file.
Why LazyTools

How this compares to other JSON formatters

FeatureLazyToolsJSONLintjsonformatter.orgJSON Editor Online
Format / pretty-printYesYesYesYes
Validate with line numbersYes — line & columnYesYesYes
Minify to one lineYesYesYesYes
Interactive tree viewYes — collapse/expandNoNoYes
JSONPath queryYesNoNoPartial
JSON to YAMLYes — same pageNoSeparate pageNo
File uploadYesNoYesYes
100% client-sideYesYesNo — serverYes
Quick reference

JSONPath syntax quick reference

ExpressionSyntaxWhat it selects
Root$The entire document
Child$.userThe "user" property at root level
Nested child$.user.nameThe "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$..nameAll "name" properties anywhere in the document
Recursive descent array$..idAll "id" values at any depth
Nested array property$.users[*].emailThe "email" of every user in the array
Multiple levels$.data.items[*].idIDs from items nested inside data
Complete guide

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.

Frequently asked questions

Paste your JSON into the input area and click Format. The formatted output appears in the right panel with proper indentation. Select 2 spaces, 4 spaces or tab from the indent selector to change the style. Click Copy to copy the result or Download to save it as a .json file.
The most common causes: trailing commas after the last item in an array or object (e.g. [1,2,3,] — the final comma is invalid), single-quoted strings (JSON requires double quotes), unquoted property names, and missing commas between properties. The error panel shows the exact line and column number of the problem.
JSONPath is a query language for extracting values from JSON. $ is the root. $.name gets the "name" property. $.users[*].email gets the email of every user. $..id gets all "id" values at any depth. Switch to the JSONPath Query tab, paste your JSON, enter an expression, and click Run to see the results as a JSON array.
No. All processing happens entirely in your browser using JavaScript. Your JSON never leaves your device. This makes the tool safe for sensitive data including authentication tokens, internal API responses, database exports, and confidential configuration files.
Click the JSON to YAML tab, paste your JSON in the left panel, and the YAML conversion appears automatically in the right panel. Click Copy YAML to copy the result. YAML is the native format for Kubernetes, Docker Compose, GitHub Actions, Helm and many other DevOps tools.
Formatting (also called beautifying or pretty-printing) adds indentation and newlines to make JSON readable — it also validates as a side effect. Validating checks whether JSON is syntactically correct without changing it. Use Validate when you want to check JSON without altering the existing formatting, such as when reviewing a config file.
Switch to the Tree View tab and paste your JSON. The structure renders as an interactive tree. Click the ► arrow next to any object or array to expand or collapse it. Hover any value to see a copy button. Use Expand all to open the entire tree, or Collapse all to return to the top level.
Minifying JSON removes all whitespace — spaces, newlines and indentation — to produce the smallest possible JSON string. Use it to reduce the size of HTTP request and response payloads, embed JSON in HTML data attributes, store JSON in databases with character limits, or compare two JSON strings for equality by stripping formatting differences.
Related tools

More free web dev and data tools