JSON Data Types (string, number, boolean, null, object, array)

JSON has exactly six data types. Unlike programming languages, which usually have dozens of types (integer, float, date, etc.), JSON keeps a very lean set. This post lists each one quickly, with syntax and important notes.

String

Text, always in double quotes.

"any text"

Special characters inside a string need to be escaped: double quotes (\"), backslash (\\), line break (\n), among others.

Number

Numbers, without quotes. JSON doesn’t distinguish integers from decimals (floats) in its syntax, both are just “number.”

42
3.14
-7
1.5e10

Some formats aren’t accepted: a leading zero (01), a decimal point with no digit before (.5) or after (5.) it.

Boolean

Only two possible values, without quotes.

true
false

Null

Represents the absence of a value, without quotes.

null

Worth noting null is different from a key simply not existing in the object. {"age": null} means the field exists, but is empty; an object without the age key means the field wasn’t provided at all.

Object

A collection of key-value pairs, delimited by curly braces {}.

{"name": "Ana", "age": 30}

Array

An ordered list of values, delimited by square brackets [].

["item1", "item2", "item3"]

Types that do NOT exist in JSON

Worth highlighting what isn’t a valid type, since this tends to confuse people coming from other languages.

  • undefined: exists in JavaScript, not in JSON
  • NaN and Infinity: exist in JavaScript, not in JSON
  • Date: there’s no native date type; dates are usually represented as strings in a specific format (like ISO 8601: "2026-01-15T10:00:00.000Z")
  • Functions: JSON represents data, not executable code

Summary table

TypeSyntaxExample
StringIn double quotes"text"
NumberNo quotes42, 3.14
BooleanNo quotestrue, false
NullNo quotesnull
ObjectIn curly braces{"key": "value"}
ArrayIn square brackets["a", "b"]

If you’re unsure whether a specific value is a valid type in JSON, paste the content into JSON Validator to confirm.