JSON in one sentence

JSON is a lightweight text format for storing and exchanging structured data: names, numbers, lists, settings, API responses, and similar data that software needs to read reliably.

A tiny example looks like this:

json
{
  "name": "Ava",
  "active": true,
  "roles": ["admin", "editor"]
}

Read it as a small data record. The outer {} means this is an object. Inside the object, "name", "active", and "roles" are keys. Each key has a value after the colon. "Ava" is a string, true is a boolean, and ["admin", "editor"] is an array containing two strings.

JSON is not a programming language. It does not run code, call functions, or include logic. It is data written in a strict text format so many languages and tools can parse it the same way.

The six value types you’ll see are strings, numbers, booleans (true or false), null, objects, and arrays. Most data you read is made from those pieces nested inside each other.

How to read it without getting lost

Start from the outside and work inward. First ask: is the top-level value an object or an array? An object starts with { and contains named fields. An array starts with [ and contains an ordered list of values.

Here’s a slightly nested example:

json
{
  "user": {
    "id": 42,
    "name": "Mina"
  },
  "notifications": [
    {
      "type": "email",
      "enabled": true
    },
    {
      "type": "sms",
      "enabled": false
    }
  ]
}

Scan it like this:

  • The whole thing is an object because it starts with {.
  • That object has two keys: "user" and "notifications".
  • "user" points to another object with "id" and "name".
  • "notifications" points to an array because its value starts with [.
  • The array contains two objects, one for email and one for SMS.

Three punctuation marks do most of the work. A colon separates a key from its value: "id": 42. A comma separates items: one field from the next, or one array item from the next. Braces and brackets must match: every { needs a }, and every [ needs a ].

Keys are always strings in double quotes. "name" is valid as a key. name is not valid, even if it looks familiar from JavaScript.

The syntax rules that break most files

It is strict on purpose. That strictness is why machines can parse it consistently, but it also means one small punctuation mistake can make the entire file invalid. If you’re stuck, paste the data into the JSON Formatter, Validator & Fixer before guessing; a validator usually points near the broken spot.

The most common syntax errors are trailing commas, single quotes, unquoted keys, comments, and missing closing brackets or braces.

Trailing commas are not allowed:

json
{
  "name": "Ava",
  "active": true,
}

Valid data removes the final comma:

json
{
  "name": "Ava",
  "active": true
}

Single quotes are not valid for strings or keys:

json
{
  'name': 'Ava'
}

Use double quotes instead:

json
{
  "name": "Ava"
}

Unquoted keys also break it:

json
{
  name: "Ava"
}

The key must be quoted:

json
{
  "name": "Ava"
}

Comments are another common surprise. This may work in a JavaScript file, but it is not valid data:

json
{
  "limit": 10,
  // show only active users
  "activeOnly": true
}

If you need notes, store them as data or use a different format that supports comments:

json
{
  "limit": 10,
  "activeOnly": true,
  "note": "show only active users"
}

Missing brackets can be harder to spot in compact text. Formatting helps because the indentation shows which object or array is still open.

Where it shows up in real work

APIs are the place many beginners first meet it. A server might return a user record like this:

json
{
  "id": 42,
  "email": "mina@example.com",
  "plan": "pro"
}

Your app can parse that response and read email or plan by name. The same pattern works in the other direction: an app often sends it in a request body when creating an account, saving settings, or submitting form-like data.

It also appears in config files, app settings, exported data, logs, and browser storage. You might edit a package setting, inspect a saved preference, or open an export from another tool and see the same object-and-array structure.

JWTs are related but not the same thing as plain files. A JSON Web Token has encoded sections, and the payload section often decodes into claims such as "sub", "exp", or "role". If you need to inspect one safely in your browser, use the JWT Decoder & Inspector.

URL query strings are different. ?page=2&sort=name carries key-value data, but it is not it. If you’re reading or fixing encoded URL text, use a URL tool instead of a parser.

When it is the wrong choice

It is a poor fit when humans need to write long notes, comments, or richly formatted text. Standard data has no comments, no headings, no bold text, and no way to preserve document-style formatting beyond storing text inside strings.

It can also be awkward for highly relational data. If every record points to many other records, a table-based database or a format designed around relationships may be easier to query and maintain than deeply nested structures.

Binary data is another weak spot. It is text, so images, PDFs, audio, and other binary files must be encoded first, often with Base64. That makes the data larger and less pleasant to inspect. For example, a small image embedded as a string may turn a readable file into a long wall of encoded characters.

It is also not the same as URL encoding. If you need to safely place text inside a URL query parameter, percent-encoding is the relevant format; try the URL Encoder / Decoder for that job.

If the data is meant mainly for people to edit by hand, a simpler or more forgiving format may be better. It is excellent for predictable machine-readable data, not for every text file.

A quick way to check and fix it

Paste suspicious data into a validator before hunting by eye. The fastest path is usually: validate, format, read the error, fix the punctuation near the error, then validate again.

Use the JSON Formatter, Validator & Fixer when you need to check syntax, beautify compact data, minify formatted data, or repair common mistakes. It runs in your browser, so the data does not need to be uploaded to a server.

Formatting is useful because structure becomes visible. Compact data like this is hard to scan:

json
{"user":{"id":42,"name":"Mina"},"active":true}

Beautified data makes the nesting obvious:

json
{
  "user": {
    "id": 42,
    "name": "Mina"
  },
  "active": true
}

Minifying does the opposite: it removes extra spaces and line breaks to make it smaller for transfer or storage. Beautifying is better when you’re editing or debugging. Minifying is better when a system wants compact text.

If a parser says it cannot parse it, take the message seriously. One missing quote, one extra comma, or one unclosed array is enough to reject the whole value.