JSON Data Types: Strings, Numbers, Booleans, Null, Arrays and Objects
JSON has exactly six kinds of value. Knowing them, and knowing what JSON does not have, explains why dates arrive as strings and why some IDs are quoted. This guide shows one example that uses all six and how each maps to common programming languages.
One example with every type
{
"name": "Ada",
"age": 36,
"active": true,
"manager": null,
"skills": ["math", "code"],
"address": { "city": "London" }
}"name" is a string, "age" a number, "active" a boolean, "manager" null, "skills" an array and "address" a nested object. Paste it into the JSON Viewer to see the structure as a tree.
The six types
| Type | Example | Notes |
|---|---|---|
| String | "Ada" | Text in double quotes, Unicode allowed |
| Number | 36, -1.5, 2e3 | No distinction between integer and decimal in JSON itself |
| Boolean | true, false | Lowercase only |
| Null | null | An explicit "no value" |
| Array | [1, "a"] | Ordered list of any values |
| Object | {"k": "v"} | Unordered set of string keys and values |
How the types map to languages
| JSON | JavaScript | Python | Java | Go |
|---|---|---|---|---|
| string | string | str | String | string |
| number | number | int / float | int, long, double | int, float64 |
| boolean | boolean | bool | boolean | bool |
| null | null | None | null | nil |
| array | Array | list | List | slice |
| object | object | dict | Map or a class | map or struct |
Because JSON has a single number type, each parser decides whether 36 becomes an integer or a float. The JSON to TypeScript, JSON to Java and other generators infer an integer type when every sample value is whole.
What JSON does not have
- Dates. Send them as strings, ideally in ISO 8601 format such as
"2026-10-03T14:30:00Z", or as a number of seconds or milliseconds since the Unix epoch. Document which you use. - Binary data. Encode bytes as a string, usually Base64. See the Base64 guide.
- Big integers. Values above 253 lose precision in JavaScript. Send them as strings.
- Undefined. Omit the key or use
null; they mean different things to many APIs.
null versus a missing key
{"middleName": null} says the field exists and has no value. {} says nothing about it. In a PATCH request, the first often means "clear this field" while the second means "leave it unchanged". Decide on a convention and use it consistently.
Frequently asked questions
Is there an integer type in JSON?
No. JSON has one number type. Whether a value is treated as an integer depends on the parser and your code.
How should I send a date in JSON?
As an ISO 8601 string such as "2026-10-03T14:30:00Z". It sorts correctly as text and is unambiguous about the time zone.
Can an array contain different types?
Yes, JSON allows it, though consistent types make data easier to process and to describe with a schema.