Skip to content
Fundamentals

What Is JSON? A Beginner's Guide You Actually Need

·8 min read
What Is JSON? A Beginner's Guide You Actually Need - Fundamentals guide from JSON Prettifier

Quick answer: JSON (JavaScript Object Notation) is a lightweight, text-based format for storing and exchanging structured data. It is built from just two structures, objects ({} key-value pairs) and arrays ([] ordered lists), and supports six value types: string, number, boolean, null, object, and array. Nearly every web API, configuration file, and document database uses it because it is simple, language-independent, and readable by both humans and machines.

If you have ever opened a package.json file, copied an API response into a text editor, or saved user settings in a web app, you have already used JSON. You just might not have known what to call it.

JSON is the universal shipping container of the internet. It is not a programming language. You cannot build apps with it. But every app you use relies on it to move information from one place to another. It is boring, invisible, and absolutely essential.

Open a valid sample in the JSON Viewer to explore objects and arrays as collapsible nodes alongside the formatted code.

A 30-Second History Lesson

JSON was specified by Douglas Crockford in the early 2000s. He didn't invent a new format - he discovered that a subset of JavaScript's object literal syntax already worked perfectly as a language-independent data interchange format. He formalized the rules, gave it a name, and published the spec at json.org in 2002.

Simplicity is why JSON won. The entire specification fits on a single page. There is almost nothing to argue about, almost nothing to implement incorrectly, and almost nothing to learn. It was later standardized as ECMA-404 and RFC 8259, but the spec barely changed - because there was barely anything to change.

What JSON Actually Looks Like

JSON is built on two structures: objects (key-value pairs wrapped in curly braces) and arrays (ordered lists wrapped in square brackets). That's it. Everything in JSON is one of these two containers, or a value inside them. If you are unsure which container to reach for, JSON array vs object walks through the decision.

Objects

An object is a collection of key-value pairs. Keys must be strings in double quotes:

{
  "name": "Ada Lovelace",
  "born": 1815,
  "knownFor": "First computer programmer"
}

Arrays

An array is an ordered list of values:

{
  "languages": ["Python", "JavaScript", "Go", "Rust"]
}

The Six Value Types

JSON supports exactly six value types:

  • String - Text in double quotes: "hello"
  • Number - Integer or floating point: 42, 3.14, -7, 1.2e10
  • Boolean - true or false (lowercase, no quotes)
  • Null - null (lowercase, no quotes)
  • Object - Nested {}
  • Array - Nested []

That's the complete list. There is no date type - dates travel as strings, and JSON date format explains which string to use. There is no undefined either; the difference matters more than it looks, as JSON null vs undefined shows. No comments. No functions. This constraint is intentional - it keeps the format simple, unambiguous, and parseable by every programming language on earth.

Where You Will Encounter JSON

REST APIs

This is the big one. The vast majority of web APIs send and receive JSON. When your frontend fetches data from a backend, JSON is almost certainly the format on the wire. Every major API - GitHub, Stripe, Twilio, OpenAI - returns JSON by default. Our guide to JSON in REST APIs covers how those responses are structured.

Configuration Files

package.json, tsconfig.json, .eslintrc.json - the JavaScript ecosystem and the broader developer world lean heavily on JSON for configuration. (If one of these files just landed in your downloads folder, see how to open a JSON file.) It is not always ideal for this purpose - the lack of comments is painful, and comments in JSON covers the workarounds - but it has become the convention.

Databases

Document databases like MongoDB store data as JSON (technically BSON). PostgreSQL and MySQL both have native JSON column types, letting you store semi-structured data inside relational tables. JSON blurs the line between relational and document databases in useful ways.

Browser Storage

Browser localStorage only stores strings, so JSON.stringify() and JSON.parse() are the standard way to persist structured data on the client side. If you have ever saved a user's preferences or a shopping cart in the browser, you have used JSON serialization.

Common Mistakes That Trip Up Beginners

JSON is stricter than JavaScript. If you are coming from JS, these will trip you up:

// These are all INVALID JSON:

{ name: "test" }            // unquoted key
{ 'name': 'test' }          // single quotes
{ "name": "test", }         // trailing comma
{ "name": "test" /* */ }    // comment

Every key must be a double-quoted string. Every string value must use double quotes - not single quotes. Trailing commas after the last item in an object or array are not allowed. And you cannot include comments, even though every developer on earth wishes you could. The full list of differences is in JSON vs JavaScript object.

Why Formatting Matters

Raw JSON from an API or a minified file is typically one long line of text. Hundreds of characters of nested brackets, quotes, and commas, with no visual structure. It is nearly impossible to read.

A formatter adds indentation and line breaks so you can actually see the hierarchy. It transforms a wall of text into something you can scan in seconds. Try it yourself with our online JSON formatter - paste any JSON and see the difference instantly.

For a complete walkthrough of formatting methods, see our guide on how to format JSON. And if you are running into syntax errors, check out the most common JSON errors and how to fix them.

Frequently Asked Questions

What does JSON stand for?
JSON stands for JavaScript Object Notation. It was formalized by Douglas Crockford in the early 2000s as a subset of JavaScript's object literal syntax, and later standardized as ECMA-404 and RFC 8259.
Is JSON a programming language?
No. JSON is a text-based data format, not a language. It has no variables, logic, or functions. Its only job is to describe structured data so that it can be stored or sent between programs written in any language.
What data types does JSON support?
JSON has exactly six value types: string, number, boolean, null, object, and array. There is no date type, no undefined, and no comments. Dates are stored as strings, usually in ISO 8601 format.
Does JSON allow comments?
Standard JSON does not allow comments of any kind. Variants such as JSONC and JSON5 do, and VS Code uses JSONC for its own settings files, but a strict parser will reject a file that contains them.
What is the difference between JSON and a JavaScript object?
A JavaScript object is an in-memory data structure; JSON is a string that follows stricter rules. JSON requires double-quoted keys and strings, forbids trailing commas and comments, and cannot hold functions or undefined. JSON.parse() and JSON.stringify() convert between the two.

See JSON Formatting in Action

Now that you understand JSON, try pasting a real API response into our formatter and see how much easier it is to read.

Open JSON Prettifier