ToolBook
Switch to dark modeSupport us on Ko-fi
Help us keep this free, forever
Developer1 min read

What is JSON? A practical guide to reading, validating, and fixing it

JSON is a lightweight text format for structured data. Here are its six value types, the strict rules that cause most errors, and how to format and validate it.

ToolBookJun 8, 2026

JSON (JavaScript Object Notation) is a lightweight, text-based format for storing and exchanging structured data as key-value pairs and ordered lists. It is the default format for web APIs, config files, and data interchange because it is human-readable and maps cleanly to the data structures every programming language already has.

A JSON value is one of six types: a string, a number, a boolean (true or false), null, an object ({} of key-value pairs), or an array ([] of ordered values). Objects and arrays nest, which is how JSON represents anything from a single setting to a deep API response.

A minimal example

{
  "name": "Ada",
  "active": true,
  "roles": ["admin", "editor"],
  "projects": 3
}

That object holds a string, a boolean, an array of strings, and a number. Keys are always double-quoted strings; values can be any JSON type.

The rules that trip people up

Most "invalid JSON" errors come from a short list of strict rules that JSON does not bend on:

RuleValidInvalid
Keys must be double-quoted"id": 1id: 1
Strings use double quotes, not single"ok"'ok'
No trailing comma[1, 2][1, 2,]
No comments allowed(none)// note
Literals are lowercasetrue, nullTrue, NULL

A single trailing comma, or a curly quote pasted from a document, is the most common reason a parser rejects an otherwise fine file.

How to read and fix messy JSON

Minified JSON arrives as one long line, which is unreadable. Formatting (also called pretty-printing) re-indents it so the structure is visible, and validation tells you the exact spot where parsing breaks. Our JSON formatter does both in your browser: paste the JSON and it pretty-prints valid input or points to the character where the syntax fails. To shrink a file for shipping, the same tool minifies it back to one line.

When you need a different shape

JSON is great for nested data, but spreadsheets and many data pipelines want rows and columns. To move between them, the JSON to CSV converter flattens an array of objects into a table and back again. For infrastructure and CI config, the YAML to JSON converter handles both directions.

For the rest of the kit, from Base64 encoding to JWT decoding, browse all our developer tools.