JSON Data Types

JSON Data Types

In JSON, the data are in key/value pairs. Key and value is separated by a colon :.JSON value must be of the following data types:String, Number, Object (JSON object), Array, Boolean, NULL

Please keep in mind that JSON value does not support the following data types: function, date, undefined.

Let us understand each of the data types.

JSON Strings

JSON value having data type string, must be written inside the double quotes.

General Syntax

Try it now

Source Code

Try it now

JSON Numbers

JSON value having data type number must be written without double quotes and it will be of integer or floating-point.

Source Code

Try it now

JSON Objects

JSON data value type might be an object.

Source Code

Try it now

JSON Arrays

JSON data value can be array. Let us understand it with the help of an example

Source Code

Try it now

JSON Booleans

JSON data value can be either true or false.

Source Code

Try it now

JSON null

JSON data value can be null.

Source Code

Try it now