Skip to content

JSON Data Types

Learn about the six valid JSON data types (strings, numbers, objects, arrays, booleans, and null) and how to use them correctly in JSON syntax.

JSON Data Types

In JSON, values must be one of the following data types:

  • a string
  • a number
  • an object (JSON object)
  • an array
  • a boolean
  • null

JSON String

Strings in JSON must be written in double quotes.

Example:

{"name":"John"}

JSON Number

Numbers in JSON must be an integer or a floating point.

Example:

{"age":30}

JSON Object

Values in JSON can be objects.

Example:

{  
	"employee":{"name":"John", "age":30, "city":"New York"}  
}

JSON Array

Values in JSON can be arrays.

Example:

{  
	"employees":["John", "Anna", "Peter"]  
}

JSON Boolean

Values in JSON can be true/false.

Example:

{"myboolean":true}

JSON null

Values in JSON can be null.

Example:

{"middlename":null}
Navigation