6 keys in total; the deepest value sits 2 levels down.
Pretty-print
One member or item per line, indented 2 spaces per level.
Strings and numbers are copied exactly as written, so escapes and number formats are unchanged.
About the JSON formatter and validator
The validator parses the text with the RFC 8259 grammar: objects, arrays, double-quoted strings, numbers, true, false and null, and nothing else. If parsing succeeds, it prints the same values back, either with one member per line and 2 spaces, 4 spaces or a tab per level, or minified with every space outside strings removed. If it fails, it reports the line and column where the grammar broke and what it expected there.
Developers use it to read API responses and config files and to shrink payloads. The default object has 6 keys and 10 values nested 2 levels deep, and pretty-printing it with 2 spaces grows it from 125 to 168 bytes.
Strings and numbers are copied exactly as written, so escapes survive and a large integer such as 12345678901234567890123 keeps every digit.
Trailing commas, single quotes and unquoted keys cause most failures, because JSON requires double quotes around every string and key and allows no comma after the last item. Comments, NaN, Infinity and hex numbers are also invalid under RFC 8259, although JavaScript accepts some of them in code. The error message here gives the line and column, so you can go straight to the character that broke the parse.
Does JSON allow comments?
No. RFC 8259 and ECMA-404 define no comment syntax, so a standard parser rejects // and /* */. Douglas Crockford removed comments from the format early on because people were using them to hold parser directives. Config files that need comments use JSON5 or JSONC, the format of VS Code's settings.json, and this validator reports those files as invalid JSON.
How large can a JSON number be?
RFC 8259 sets no limit, but it warns that only integers between −(2^53 − 1) and 2^53 − 1 = 9,007,199,254,740,991 are sure to interoperate, since many parsers use IEEE 754 doubles. This tool copies numbers digit for digit, but JavaScript's JSON.parse turns 12345678901234567890123 into 1.2345678901234568e22, so send large IDs as strings.
Are duplicate keys allowed in JSON?
RFC 8259 says the names within an object SHOULD be unique, so duplicates are legal but unreliable: JavaScript's JSON.parse and Python's json module keep only the last value, while other parsers keep the first or reject the document. This validator accepts them but warns with the line and column of the object, so you can remove the duplicate before another system reads it differently.
What is the difference between pretty-printing and minifying JSON?
Pretty-printing puts each member on its own line with 2 or 4 spaces or a tab per level, which makes the data easy to read and diff; minifying removes every space and line break outside strings for transfer. Both describe exactly the same data. The default example grows from 125 to 168 bytes when pretty-printed, and the minify example shrinks from 45 to 33 bytes.
How accurate is the JSON formatter and validator?
Accuracy depends on your inputs and the method's assumptions. Decimal arithmetic uses 50 significant digits, but estimates, numerical methods and source data can be less precise; the displayed rounding does not remove those limits. It is checked against 6 worked examples whose answers come from independent sources; for example, “Pretty-print with 2 spaces” is checked against Python 3.8: json.dumps(json.loads(s), indent=2, ensure_ascii=False); value count by walking json.loads(s).
Where does the method come from?
RFC 8259 — The JavaScript Object Notation (JSON) Data Interchange Format; ECMA-404 — The JSON data interchange syntax, 2nd edition.