JSON can only hold a few kinds of values. That is one reason it is so simple. It is also why almost every programming language can read it.
But it also means some things you use in code have no place in JSON. Dates and undefined are two examples.
This guide shows every JSON data type with examples. It also covers what is not allowed, and how people usually store dates.
Quick answer: JSON has six data types: string, number, boolean (true or false), null, array and object. Other things are not allowed in standard JSON. This includes dates, undefined, NaN and comments.
Here is one small example that uses all six:
{
"title": "Blue T-shirt",
"price": 19.99,
"inStock": true,
"discount": null,
"sizes": ["S", "M", "L"],
"maker": { "name": "Acme", "country": "PT" }
}Tip: does your JSON come on one long line? Paste it into the JSON Formatter. It puts each value on its own line.
1. String
A string is text. In JSON, a string must have double quotes around it.
"Hello, world"
"café ☕"
"She said \"hi\""
"Line one\nLine two"Some characters need an escape. An escape is a backslash followed by a code:
\"for a double quote inside the string\\for a backslash\nfor a new line, and\tfor a tab\u00e9for any character by its Unicode number (here, é)
Single quotes are not allowed, so 'hello' is not valid. Letters from any language are fine as they are. So are emoji.
2. Number
JSON has one number type. It covers whole numbers and decimals. They can be positive or negative:
42
-7
3.14
0.5
1.5e3The last one uses scientific notation, a short way to write big or small numbers. 1.5e3 means 1.5 × 1000, which is 1500.
JSON numbers have a few strict rules:
- No zeros at the start:
007is not valid. Use7. If the zeros matter, as in a ZIP code, use the string"007". - A decimal point needs a digit on both sides. Write
0.5, not.5. Write5.0or5, not5. - No plus sign at the start. No hex numbers like
0xFF. - No
NaNorInfinity.
Don’t put numbers in quotes unless you want them to be text. "42" is a string, not a number.
JSON itself has no size limit for numbers, but many programs do. JavaScript, for example, can’t store every whole number above 9,007,199,254,740,991 exactly. Larger IDs can get rounded.
Read why big numbers break in JSON to learn more and see the fixes.
3. Boolean
A boolean is a yes/no value. It is either true or false. It is always in lowercase, with no quotes.
{ "isAdmin": false, "emailVerified": true }True, FALSE and "true" are all wrong here. The first two are not valid JSON. The last one is valid, but it is a string, not a boolean.
Python’s True and False often get into JSON by mistake. This happens when someone prints a Python dictionary instead of converting it with json.dumps().
4. Null
null means “no value” or “empty on purpose”. It is written in lowercase, with no quotes.
{ "middleName": null }A key set to null is not the same as a missing key. null says “this field exists, but it has no value”. A missing key says nothing at all. Many APIs treat these two cases differently.
5. Array
An array is a list of values in order. It goes inside square brackets, with commas between the values.
["red", "green", "blue"]
[1, 2, 3]
[]
[{ "id": 1 }, { "id": 2 }]Order matters in an array. The first item stays first. An array can be empty. It can even mix types, like [1, "two", true].
Mixed arrays are valid. But code is usually easier to write when every item has the same type.
6. Object
An object is a group of key–value pairs inside curly braces. Each key is a string in double quotes. A colon and a value come after it.
{
"name": "Ada",
"age": 36,
"address": { "city": "London" }
}A value can be any JSON type. It can even be another object or an array. This is called nesting.
Keys should be unique inside one object. If a key appears twice, most JSON readers keep only the last value. They do this without any warning.
JSON with many levels can be hard to follow. The JSON Viewer shows it as a tree. Strings, numbers, booleans and null each get a different colour. So you can see each type quickly.
What is not allowed in JSON?
These things are common in code, but they are not valid JSON:
- undefined. Use
null, or leave the key out. JavaScript’sJSON.stringify()removes keys whose value isundefined. - NaN and Infinity.
JSON.stringify()writes them asnull. Choose how to store them yourself, for example asnullor as a string. - Comments. JSON has no way to write comments. See JSON and comments for other ways to add notes.
- Single quotes and keys without quotes.
{ name: 'Ada' }is a JavaScript object, not JSON. - Extra commas at the end. There is no comma after the last item.
- Functions, dates and other special types. JSON only stores plain data.
Not sure if your JSON follows the rules? Paste it into the JSON Validator. It shows the line and column of a problem. It also explains the problem in plain English.
How are dates stored in JSON?
JSON has no date type. Most people store a date as a string in ISO 8601 format. ISO 8601 is a world standard for writing dates and times:
{
"birthday": "1990-04-15",
"createdAt": "2026-11-23T14:30:00Z"
}The T separates the date from the time. The Z means the time is in UTC. Do all your dates use this same format and time zone? Then they even sort in the right order as text.
In JavaScript, JSON.stringify() turns a Date into this format for you. But JSON.parse() does not turn it back. You get a string, and you need to change it into a date yourself:
const json = JSON.stringify({ createdAt: new Date() });
// '{"createdAt":"2026-11-23T14:30:00.000Z"}'
const data = JSON.parse(json);
const createdAt = new Date(data.createdAt);In Python, json.dumps() gives an error if you pass it a datetime object. Call .isoformat() on it first to turn it into a string.
Another choice is a Unix timestamp. This is the number of seconds (or milliseconds) since 1 January 1970, stored as a number.
It is short, but hard for people to read. You also need to know if it counts seconds or milliseconds.
How do JSON types match your programming language?
- JavaScript: object → object, array → array, string → string, number → number, true/false → boolean, null → null.
- Python: object → dict, array → list, string → str, number → int or float, true/false → True/False, null → None.
Common questions
How many data types does JSON have?
Six: string, number, boolean, null, array and object. The first four are simple values. Arrays and objects hold other values.
Does JSON have a date type?
No. Dates are usually stored as ISO 8601 strings, like "2026-11-23T14:30:00Z". Your code turns them into real dates after it reads the JSON.
Does JSON tell whole numbers and decimals apart?
Not in JSON itself. There is just one number type. The program that reads the JSON decides what 3 becomes: a whole number or a decimal.
Can a JSON document be just a string or a number?
Yes. Under the current JSON standard, any single value is valid JSON on its own. Examples are "hello" and 42. Most real files use an object or an array at the top level.