JSON keeps its type system deliberately small. Six value types are all you get, and that simplicity is exactly why every programming language can support JSON so easily. In this lesson of our JSON tutorial series, we examine each type in detail, show how popular languages map them, and highlight the traps that catch developers, such as precision loss in large numbers and the absence of a date type.
{
"string": "hello world",
"number": 3.14159,
"boolean": true,
"nothing": null,
"object": { "nested": "yes" },
"array": [1, 2, 3]
}A JSON string is a sequence of Unicode characters wrapped in double quotes. Strings carry text, but by convention they also carry everything JSON cannot express natively, including dates ("2026-07-20"), UUIDs, URLs, and even base64-encoded binary data. Remember the escape rules from the previous lesson: quotes, backslashes, and control characters must be escaped.
JSON has a single number type covering integers and decimals: 42, -7, 19.99, 1.5e10. There is no separate int or float, and no size limit in the specification. In practice, JavaScript stores all numbers as 64-bit floats, so integers above Number.MAX_SAFE_INTEGER (9007199254740991) silently lose precision. That is why APIs such as Twitter return large IDs twice, once as a number and once as a string like "id_str". When exact precision matters, transmit the value as a string.
The literals true and false, always lowercase. Writing True or FALSE is a syntax error, a common slip for Python developers whose language capitalizes its booleans.
null represents an intentional absence of a value. Note the difference between a key set to null and a key that is missing entirely; many APIs treat those cases differently. For example, in a PATCH request, "nickname": null may mean clear the nickname, while omitting the key means leave it unchanged.
Objects are collections of key and value pairs. The JSON specification says object keys are unordered, so never write code that depends on key order. Duplicate keys are technically permitted by the grammar but produce undefined behavior; most parsers keep the last occurrence. Avoid them.
Arrays are ordered lists that may mix types freely: [1, "two", true, null, {"three": 3}]. In practice, well-designed APIs keep array elements homogeneous, such as an array of user objects, because mixed arrays are hard to handle in statically typed languages.
| JSON | JavaScript | Python | Java | |------|-----------|--------|------| | string | string | str | String | | number | number | int / float | Integer / Double | | boolean | boolean | bool | Boolean | | null | null | None | null | | object | Object / Map | dict | Map / POJO | | array | Array | list | List |
There is no type for dates, times, binary data, functions, regular expressions, or undefined. JSON.stringify in JavaScript simply drops object properties whose value is undefined or a function. Standard conventions fill the gaps: ISO 8601 strings for timestamps and base64 strings for binary blobs.
Next up: JSON Objects and Nesting, where we build deeply structured documents and learn to navigate them.