Syntax & Data Types
JSON's entire syntax fits on an index card. That's the point — a format meant to be parsed by every language in existence has to be small, strict, and unambiguous. There are exactly six data types, and every one of them has one, and only one, valid way to be written.
💡 The Bottom Line
JSON has six data types: string, number, boolean, null, object, and array. Every value in a JSON document is one of these six, nested as deeply as you like — and the rules for writing each one are strict, with no wiggle room for "close enough."
The six data types
{
"aString": "hello",
"aNumber": 42.5,
"aBoolean": true,
"aNull": null,
"anObject": { "nested": "value" },
"anArray": [1, 2, 3]
}
- String — always wrapped in double quotes. Single quotes are not valid JSON, no matter how common they are in JavaScript source code.
- Number — no distinction between integers and decimals, no quotes. Leading
zeros and trailing decimal points (like
01or5.) aren't allowed. - Boolean — exactly
trueorfalse, lowercase, no quotes. - Null — exactly
null, lowercase, no quotes. There's no separate concept of "undefined" in JSON. - Object — an unordered set of key-value pairs in
{ }, where every key is a double-quoted string. - Array — an ordered list of values in
[ ], which can be any mix of the other five types.
⚠️ Watch Out
Two of the most common "invalid JSON" mistakes come straight from JavaScript habits:
using single quotes ('like this') instead of double quotes, and leaving a
trailing comma after the last item in an object or array
({"a": 1,}). Both are perfectly legal in JavaScript object literals but will make
a JSON parser reject the document outright.
Keys are always strings
Unlike a JavaScript object, where you can sometimes get away with unquoted keys
({name: "Ada"}), every key in a JSON object must be a double-quoted
string: {"name": "Ada"}. There's no shorthand, no computed keys, no symbols as keys
— just strings.
🙋 There Are No Dumb Questions
Q: Can a JSON number represent something like a very large integer or a date?
A: Not natively. JSON's number type is a general-purpose floating-point-ish number with no
guaranteed precision limit specified by the format itself — but in practice, most parsers use
a standard double-precision float, which starts losing exact precision on integers larger than
about 2^53. Dates aren't a JSON type at all — they're almost always sent as an ISO 8601
string, like "2026-07-13T10:00:00Z", and it's up to your code to parse that
string back into a real date object.
🔧 Try It Yourself
Try writing a JSON object describing yourself — name (string), age (number), a boolean for
whether you're currently learning something new, and an array of your favorite three
technologies. Paste it into a JSON validator (or just try JSON.parse() in a
browser console) and see if it's valid on the first try.
✅ Quick Check
Which of these is invalid JSON?
Next up: objects and arrays in depth — how nesting works, and how to think about JSON structure the way an experienced developer does.