Skip to content
jsonblocks

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.

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.

All six types in one document

json
{
  "name": "Ada Lovelace",
  "id": 1024,
  "score": 98.6,
  "verified": true,
  "nickname": null,
  "roles": ["admin", "editor"],
  "address": { "city": "London" }
}

The four primitives

  • string: double-quoted text. "1024" is a string, 1024 is a number - quotes decide.
  • number: integers and decimals with no quotes. No hex, no NaN, no Infinity.
  • boolean: exactly true or false, lowercase and unquoted.
  • null: the value null, meaning explicitly empty. Different from missing and from "".

The two containers

  • object: unordered key-value pairs in braces. Keys are always double-quoted strings.
  • array: ordered values in brackets. Items can mix types, though uniform arrays are easier to process.

Types JSON does not have

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.

json
{
  "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.

Frequently asked questions

How many data types does JSON have?

Six: string, number, boolean, null, object, and array. Everything in a JSON document, at any nesting depth, is one of these.

Is there a date type in JSON?

No. Dates travel as ISO 8601 strings such as 2026-10-04T09:14:02Z and are parsed into date objects by the receiving code.

What is the difference between null and a missing key?

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.

Why does 1024 behave differently from "1024"?

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.