JSON for Beginners — What It Is and How to Read It
JSON (JavaScript Object Notation) is the data format that powers most of the modern web. REST APIs return JSON. Configuration files use JSON. NoSQL databases store JSON. If you interact with any web service or API, you're working with JSON whether you realise it or not.
Validate and format JSON instantly with our JSON Validator and Beautifier.
What JSON Actually Is
JSON is a text-based data format that uses human-readable syntax to represent structured data. It was derived from JavaScript object literal syntax but is language-independent — every major programming language has JSON parsers and serialisers built in or available as standard libraries.
The key point: JSON is just text. It's not a program, not a database, not a special file type. It's a string that follows specific formatting rules, which allows any system to read and write it reliably.
JSON Data Types
JSON supports exactly six data types:
String — text in double quotes: "hello world" Number — integer or decimal: 42 or 3.14 Boolean — true or false (no quotes, lowercase) Null — null (represents absence of value) Array — ordered list in square brackets: [1, 2, 3] Object — key-value pairs in curly braces: {"name": "Alice"}
Everything in JSON is built from these six types. There is no date type, no undefined, no function. Dates are typically stored as ISO strings: "2024-01-15T10:30:00Z".
Reading JSON — A Practical Example
{"user": {"id": 12345,"name": "Alice Chen","email": "alice@example.com","active": true,"scores": [98, 87, 92],"address": {"city": "London","country": "UK"}}}
Breaking this down: • The outermost {} is an object • "user" is a key whose value is another object • "id" is a key with a number value (12345) • "name" is a key with a string value ("Alice Chen") • "active" is a key with a boolean value (true) • "scores" is a key with an array value ([98, 87, 92]) • "address" is a key with a nested object value
To access the city in JavaScript: data.user.address.city — returns "London" In Python: data["user"]["address"]["city"] — same result
Common JSON Mistakes
• Trailing commas — JSON does not allow a comma after the last item in an object or array. {"a": 1, "b": 2,} is invalid. • Single quotes — JSON requires double quotes for strings. {'name': 'Alice'} is invalid. • Unquoted keys — all object keys must be in double quotes. {name: "Alice"} is invalid. • Comments — JSON does not support comments. // this will break your JSON. • Undefined values — undefined is a JavaScript concept, not valid JSON. Use null instead.
Validate, format and beautify any JSON — paste and check instantly
Try JSON Validator Free →
