Skip to content

Basics for Beginners · The Six JSON Data Types

All tutorials

The Six JSON Data Types

JSON has exactly six data types. Understanding these is the foundation of working with JSON.

String

A sequence of characters wrapped in double quotes. Use backslash for escaping: \" for quotes, \\ for backslash, \n for newline.

"Hello, World!"
"Escaped: \"quote\" and \\backslash\\"
"Line 1\nLine 2"

Number

Integers or decimals. No quotes. Scientific notation allowed.

42
3.14
-100
1.5e10

Boolean

Logical values. Must be lowercase: true or false.

true
false

Null

Represents absence of value. Always lowercase null.

null

Object

Unordered collection of key-value pairs in curly braces. Keys must be strings.

{"name": "Alice", "age": 30, "active": true}

Array

Ordered list of values in square brackets. Values can be any type.

["red", "green", "blue"]
[1, 2, 3, 4, 5]
[true, false, null]
stringnumberbooleanobjectarray