CodeNFacts
CodeHub
Home

All Categories


Sign In
Tools

JSON Formatter & Validator

Paste or upload JSON, format it, minify it, catch syntax errors with exact line/column numbers, and explore the result as a collapsible tree - all client-side, nothing leaves your browser.

InputValid JSON
"name": "Ada Lovelace"
"born": 1815
"isActive": true
"spouse": null
"mathematics"
"analytical engines"
"writing"
]
"city": "London"
"country": "UK"
}
}
Input size206 B
Output size
Keys8
Max depth2
Objects2
Arrays1
Strings6
Numbers1

JSON syntax cheat sheet

TypeExampleNote
Object{ "key": "value" }Unordered set of key/value pairs. Keys are always double-quoted strings.
Array[1, 2, 3]Ordered list of values. Items can be mixed types.
String"hello\nworld"Double quotes only. Supports \n \t \" \\ \uXXXX escapes.
Number-12.5e3No leading zeros, no NaN/Infinity, no hex/octal literals.
Booleantrue / falseLowercase only — no True, no 1/0.
NullnullLowercase. There is no `undefined` in JSON.

Shortcut: press Ctrl/Cmd + Enter to format from anywhere on the page.

Things to keep in mind

No trailing commas

{ "a": 1, } is invalid — remove the comma after the last item.

No comments

JSON has no // or /* */ syntax. Strip comments before parsing, or use JSON5/JSONC if you need them.

Double quotes only

'single quotes' and unquoted keys like { name: "x" } are not valid JSON.

Numbers lose precision

JSON numbers map to IEEE-754 doubles — integers beyond 2^53 (e.g. large IDs) can silently change. Send them as strings if exactness matters.

Duplicate keys: last one wins

{ "a": 1, "a": 2 } parses to { "a": 2 } in most parsers — don't rely on the first value.

No native dates

Dates aren't a JSON type. Use ISO-8601 strings ("2026-08-01T00:00:00Z") and parse on the receiving end.

Top level can be any value

"just a string" and 42 are both valid JSON documents — not everything is an object or array.

Control characters must be escaped

Raw newlines/tabs inside a string are illegal — they must appear as \n, \t, etc.

Anatomy of a JSON object

{"name": "Ada","age": 36,"active": true,"skills": ["js", "ts"],"address": { "city": "Paris" }}key : value pairs, separated by commaskey — always a double-quoted stringstring value — double quotesnumber — no quotesboolean — true / false, lowercasearray — [ ] holds an ordered listnested object — inside a valuenull — represents “no value”