Ctrl K

What Is JSON? A Plain-English Guide

beginner TheToolSera Team 7 min read Updated 2 Jun 2026

JSON is the format most of the web uses to move data around. If you have ever inspected an API response, opened a config file or looked at a browser network tab, you have already read JSON. This guide explains what it is, the handful of rules that define it, and the places it shows up day to day.

JSON in one sentence

JSON (JavaScript Object Notation) is a text format for representing structured data as nested key/value pairs and lists. It is language independent — Python, Java, Go, Rust, PHP and every browser can read and write it — but its syntax was borrowed from JavaScript, which is where the name comes from.

Because it is plain text, JSON can travel over HTTP, sit in a log line, live in a database column or be saved as a .json file. That portability is the entire reason it replaced heavier formats for most web APIs.

The syntax rules

JSON is deliberately tiny. There are only two container types and four scalar types, and the grammar fits on a single page.

  • Objects are wrapped in curly braces and hold unordered key/value pairs: { "id": 1 }
  • Arrays are wrapped in square brackets and hold ordered values: [1, 2, 3]
  • Keys must be strings in double quotes — single quotes are invalid
  • Values may be a string, number, boolean, null, object or array
  • Members are separated by commas, and a trailing comma is not allowed
A typical API response
{
  "id": 4821,
  "name": "Ada Lovelace",
  "active": true,
  "score": 98.5,
  "manager": null,
  "roles": ["admin", "editor"],
  "address": {
    "city": "London",
    "postcode": "NW1 6XE"
  }
}

The data types you can use

TypeExampleNotes
String"hello"Double quotes only; escape \" and \\ inside
Number42, -7, 3.14, 1e6No NaN, no Infinity, no leading plus sign
Booleantrue / falseLowercase only
NullnullRepresents an intentionally empty value
Object{ "k": "v" }Keys must be unique in practice, even if the spec is lenient
Array[1, "two", null]Mixed types are legal but usually a design smell

JSON is not a JavaScript object

This is the single most common misunderstanding. A JavaScript object is a runtime value in memory; JSON is a string. JavaScript object literals allow unquoted keys, single quotes, comments, functions, undefined and trailing commas. JSON allows none of those.

Valid JavaScript, invalid JSON
{
  id: 1,          // unquoted key + comment
  name: 'Ada',    // single quotes
  tags: ['a',],   // trailing comma
}
Valid JSON
{
  "id": 1,
  "name": "Ada",
  "tags": ["a"]
}

Anything you can paste into a JSON validator and get a green result is portable. If it only works after you paste it into a JS file, it is not JSON.

Where you will meet JSON

  • REST and GraphQL API request and response bodies
  • Configuration files such as package.json, tsconfig.json and composer.json
  • Structured logging, where each log line is one JSON object
  • Document databases and JSONB columns in PostgreSQL
  • Browser storage, message queues, webhooks and CI pipeline outputs

Reading JSON comfortably

Real-world JSON arrives minified — one long line with no whitespace — because that saves bandwidth. Machines do not care, but people do. Formatting adds indentation and line breaks so nesting becomes visible, and a tree view lets you collapse the parts you are not interested in.

JSON Formatter

Paste a minified response and read it as an indented, colour-coded document.

Try JSON Formatter

Common mistakes

Wrapping numbers in quotes

{"age": "30"} is a string, not a number. Consumers then have to cast it, and comparisons silently misbehave.

Using comments

JSON has no comment syntax. If you need notes in a config file, use a dedicated field such as "_comment" or switch to JSONC/YAML.

Assuming key order matters

Objects are unordered by definition. Never rely on the position of a key; look it up by name.

Emitting NaN or Infinity

Some serialisers produce these for floats. They are not valid JSON and will break strict parsers.

Best practices

  • Pick one key casing convention (camelCase or snake_case) and keep it across the whole API
  • Prefer null over an empty string when a value is genuinely absent
  • Keep arrays homogeneous — one shape per array makes consumers far simpler
  • Send minified JSON over the wire, and format it only when a human is reading it
  • Validate untrusted JSON before parsing it into typed structures

Frequently asked questions

Is JSON a programming language?

No. JSON is a data format with no logic, variables or functions. It only describes values and their structure.

What file extension does JSON use?

The .json extension with the application/json media type. Line-delimited variants often use .ndjson or .jsonl.

Can JSON store dates?

Not natively. Dates are normally stored as ISO 8601 strings such as "2026-06-02T10:15:00Z" and parsed by the consumer.

Is JSON case sensitive?

Yes. "Name" and "name" are two different keys, and true must be lowercase.

Put this into practice

JSON Formatter runs entirely in your browser — no upload, no account, no limits.

Open JSON Formatter

Related tools

Related guides

All guides

Explore related topics