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 →

FAQs

Both are text-based data formats. JSON is more compact, easier to read, and directly parseable in JavaScript. XML is more verbose but supports attributes, namespaces, and schemas. JSON has largely replaced XML for API responses and configuration files. XML still dominates in enterprise systems, document formats (Office files), and RSS/Atom feeds.
Not directly — JSON is text-only. Binary data is typically Base64-encoded before being stored as a JSON string. This is common for small images or file attachments in API responses. For large binary files, the standard practice is to store the file separately and include the URL in the JSON.
JSONP (JSON with Padding) was a hack to work around same-origin policy before CORS existed. It wraps JSON in a function call that a script tag can load cross-origin. JSONP is now largely obsolete — CORS handles cross-origin requests properly. If an API still only offers JSONP, that is a red flag about its maintenance state.
Scroll to Top
Checker Tools