JSON Formatter & Validator
Check a JSON document, make it readable, or compact it for transport. Inspect its structure without uploading it.
Read a document before changing it
JSON represents structured data with objects, arrays, strings, numbers, booleans and null. Paste a response body or open a local .json file, then choose Format JSON to indent it with two spaces. Validate checks the syntax and reports structure statistics while preserving the original text in the output. Minify removes insignificant whitespace.
A compact response, made readable
The document {"user":{"name":"Ada","active":true},"roles":["editor"]} contains two objects, one array, four object keys and three primitive values. Its deepest value is two edges from the root. Formatting puts these fields on separate indented lines; minifying the result returns the compact representation.
Understanding errors and statistics
JSON requires double-quoted keys and strings. Comments, trailing commas and single-quoted strings are not valid JSON. The error message comes from your browser’s JSON parser. A line and column are shown only when that parser supplies a character offset; browser versions can report errors differently.
Objects and arrays are counted separately. Key count excludes array indexes; primitive count includes null. Maximum depth uses the root as level zero. Byte size describes the original input encoded as UTF-8, so an emoji can take more bytes than its visible character count suggests.
Formatting is not lossless archival
This formatter uses JSON.parse and JSON.stringify. JavaScript represents numbers using binary floating point: integers beyond its safe integer range may be rounded, and extremely large exponents can become null when serialized. Duplicate object keys keep their last value. Object key order and numeric spelling may also change. Validate preserves the original text; retain it when exact numeric spelling or duplicate keys matter.
Input is limited to 5 MiB. Formatting supports up to 256 nesting levels and 16 MiB of output to avoid extreme indentation expansion. Validation statistics use an iterative traversal. This tool checks JSON syntax, not a JSON Schema or whether an API accepts the document.
Does opening a file upload it?
No. The file is read by the browser and its content is neither sent to a server nor saved between visits. Copy places the output on your system clipboard; Download explicitly creates a local JSON file. Clear removes the current input and result from the interface.
Can I format a root value such as true?
Yes. A JSON document can be a primitive value, an array or an object. Empty input is not a JSON document; an empty JSON string is written as two double quotes.