Skip to main content

JavaScript JSON Data Types

JSON Data Types

JSON (JavaScript Object Notation) is a lightweight data-interchange format that is easy for humans to read and write and easy for machines to parse and generate.

JSON supports various data types, including:

JSON String

A sequence of Unicode characters enclosed in double quotation marks.

Example:

{
"name":"John"
}

JSON Number

A numeric value represented as a decimal or exponential notation.

Examples:

{
"age":20
}

JSON Boolean

A logical value that can be either true or false.

Examples:

{
"isMaried":false
}

JSON Null

A special value that represents null or no value.

Example:

{
"middleName":null
}

JSON Object

An unordered collection of key/value pairs enclosed in curly braces. Example:

{
"name": {"John", "age": 20}
}

JSON Array

An ordered collection of values enclosed in square brackets.

Example:

{
"children": ["Jane", "Jonny"]
}