JSON has only six kinds of values. That small set is a big part of why JSON is easy to parse in every language, but it also means common types such as dates, binary data, very large integers and decimals have no native representation. This guide covers each JSON type, how it maps to popular languages, and how to represent the types JSON doesn't have.
json{ "string": "hello", "number": 42.5, "boolean": true, "null": null, "array": [1, "two", false], "object": { "nested": "value" } }
Strings are sequences of Unicode characters in double quotes. Single quotes aren't allowed. Special characters are escaped with a backslash: \", \\, \n, \t, and é for any Unicode code point. See Escape JSON strings for the full list.
JSON has one number type. It covers integers and decimals, negative values, and exponents (1.5e10). It does not allow:
007), a leading +, or a bare decimal point (.5)0x1F)NaN, Infinity or -InfinityThe JSON spec doesn't limit precision, but parsers do. JavaScript stores every number as a 64-bit float, so integers above 2^53 − 1 (9,007,199,254,740,991) lose precision:
javascriptJSON.parse('{"id": 9007199254740993}').id; // 9007199254740992
That's why APIs send large IDs, such as Twitter/X snowflake IDs, as strings.
true and false, lowercase only. True, "true" and 1 are different values.
null means "no value". It's different from a missing key, and APIs should choose deliberately which one they use; see API JSON best practices.
Ordered lists in square brackets. Items can be any type, and mixed types are allowed, although consistent item types are much easier for clients to handle. Order is meaningful.
Unordered collections of key/value pairs in curly braces. Keys must be strings in double quotes. The spec says names should be unique; with duplicates, most parsers silently keep the last value.
| JSON | JavaScript | Python | Java (Jackson) | Go |
|---|---|---|---|---|
| string | string | str | String | string |
| number | number | int or float | int, long, double, BigDecimal | float64 (or typed field) |
| true / false | boolean | bool | boolean | bool |
| null | null | None | null | nil |
| array | Array | list | List | slice |
| object | Object | dict | Map or POJO | map or struct |
| You need | Common convention |
|---|---|
| Date or time | ISO 8601 string: "2026-03-15T14:30:00Z"; see Dates and times in JSON |
| Money / decimals | Integer minor units (1999) or a decimal string ("19.99") |
| 64-bit integers | String: "id": "1234567890123456789" |
| Binary data | Base64 string; see How Base64 encoding works |
| Enum | String from a fixed set: "status": "shipped" |
| Set | Array with unique items |
| Map with non-string keys | Array of [key, value] pairs, or stringified keys |
Document these conventions in your API's schema so clients know how to read each field. JSON Schema basics shows how to express formats such as date-time and uuid.
"price": "10" in one response and "price": 10 in another breaks typed clients."active": "false" is truthy in JavaScript.0.1 + 0.2 isn't 0.3 in binary floating point.To see the types in a document at a glance, paste it into the JSON Formatter and switch to tree view.