JSON data types explained
JSON has exactly six data types: strings, numbers, booleans, null, objects, and arrays. Every value in every JSON document is one of these six - learn to spot them and any payload becomes readable.
JSON has exactly six data types: strings, numbers, booleans, null, objects, and arrays. Every value in every JSON document is one of these six - learn to spot them and any payload becomes readable.
Four types hold single values (string, number, boolean, null) and two hold nested values (object, array). There are no dates, no undefined, and no distinction between integers and floats - conventions like ISO date strings fill those gaps.
{
"name": "Ada Lovelace",
"id": 1024,
"score": 98.6,
"verified": true,
"nickname": null,
"roles": ["admin", "editor"],
"address": { "city": "London" }
}Dates are the famous gap: APIs conventionally use ISO 8601 strings like "2026-10-04T09:14:02Z" and parse them on receipt. Likewise undefined, comments, and functions from JavaScript have no JSON equivalent - undefined usually becomes null or a missing key.
{
"createdAt": "2026-10-04T09:14:02.118Z",
"price": "49.99",
"priceCents": 4999
}Money shows the same convention at work: either a string holding the display value or an integer holding minor units. When a type surprises you, check the quotes first - they are the commonest source of string-vs-number bugs.
Six: string, number, boolean, null, object, and array. Everything in a JSON document, at any nesting depth, is one of these.
No. Dates travel as ISO 8601 strings such as 2026-10-04T09:14:02Z and are parsed into date objects by the receiving code.
null means the key exists with an explicitly empty value; a missing key means the field was never sent. APIs use the distinction to separate clear-this-field from leave-it-alone.
Quotes decide the type. 1024 is a number you can do arithmetic on; "1024" is a four-character string. Mixing them up is one of the commonest API integration bugs.