JSON.parse checks syntax; JSON.stringify writes two-space indentation or compact text. The formatter does not guess repairs for malformed JSON.
JSON Formatter & Validator
Validates JSON syntax in the browser and produces readable, indented output. Parse errors are surfaced without sending the payload anywhere.
What does this tool do?
Validate, pretty-print, or minify JSON data.
Your result will appear here.
JSON Formatter & Validator: method and usage
Validates JSON syntax in the browser and produces readable, indented output. Parse errors are surfaced without sending the payload anywhere.
Paste one JSON value: an object, array, string, number, boolean, or null. Property names need double quotes; comments and trailing commas are not JSON. Confirm the shape first with a small example containing no personal data.
The result includes formatted JSON, root type, key count, maximum depth, and UTF-8 output bytes. Key count is not the same measurement as array length.
Practical steps
- Paste JSON data.
- Choose pretty or minified output.
- Copy the validated result.
With {"id":"007","active":false,"items":[]}, id must remain a string, active a boolean, and items an empty array. Compare these values after compacting and formatting again.
JavaScript Number can lose precision for large integers; keep long identifiers as quoted strings. Duplicate keys can be lost during parsing. This tool does not validate a JSON Schema.
Suitable use cases
- Inspecting API responses
- Editing config files
- Finding malformed JSON
JSON: formatting is not type conversion
With two-space indentation, the layout changes while "007" remains a string, false remains a boolean, and items remains an empty array. Product identifiers often depend on this distinction: converting an identifier to a number loses its leading zeros. Parse the output again and compare field types as well as values. This formatter does not validate a JSON schema or your application’s business rules.
{"id":"007","enabled":false,"items":[]}{
"id": "007",
"enabled": false,
"items": []
}Input that should fail
{"id":"007",}A trailing comma is invalid JSON and must produce an error; the formatter is not a repair tool that guesses your intention. Duplicate keys are a different risk: JSON.parse can retain the last value. An earlier "id" value cannot be recovered from the formatted output. Large integers also need a separate check for JavaScript number precision.
Worked decision record
Validate an API response and make it readable before attaching it to an incident report.
Format `{"requestId":"r-104","ok":true,"items":[{"id":7,"stock":0}]}`, then remove the final brace to exercise the error path.
`ok` remains a boolean, `stock` remains numeric, and `items` remains an array; only whitespace changes. The broken variant returns an explicit parse error.
Do not hand off the result if a field type changes, numeric precision is lost, or malformed input appears successful.
Guides for this tool
Auditing JSON-LD in Next.js: Article, Breadcrumb, and WebApplication
Build a safe, identity-consistent JSON-LD graph that matches visible content instead of maximizing schema count.
Read guide →Safe In-Browser Handoffs Between JSON, CSV, and Base64
Build reusable flows that reduce copy-paste while preserving data-type, encoding, and error boundaries.
Read guide →Frequently asked questions
What input does JSON Formatter & Validator accept?+
Paste one JSON value: an object, array, string, number, boolean, or null. Property names need double quotes; comments and trailing commas are not JSON. Format `{"requestId":"r-104","ok":true,"items":[{"id":7,"stock":0}]}`, then remove the final brace to exercise the error path.
What does JSON Formatter & Validator return?+
The result includes formatted JSON, root type, key count, maximum depth, and UTF-8 output bytes. Key count is not the same measurement as array length. `ok` remains a boolean, `stock` remains numeric, and `items` remains an array; only whitespace changes. The broken variant returns an explicit parse error.
How should I validate JSON Formatter & Validator output?+
With {"id":"007","active":false,"items":[]}, id must remain a string, active a boolean, and items an empty array. Compare these values after compacting and formatting again. Do not hand off the result if a field type changes, numeric precision is lost, or malformed input appears successful.
Does JSON Formatter & Validator send or store input on a server?+
Tool input is processed in the active tab. Saving to the Workstation or transferring to another tool is a separate choice. Consider browser extensions and shared devices separately; the privacy page explains advertising and network connections.