Krivalar Tutorials 
Krivalar Tutorials

JSON-Data Types


What is JSON? JSON_Syntax JSON_Data Types JSON_vs_XML JSON_Array JSON_Object

JSON uses the following data types.

Number:


	Example:
		{
			"age" : 36,
			"rate" : 250.50,
			"speed" : 3.2E11,

		}

Strings:

Strings consist of zero or more Unicode characters which are enclosed in double quotation marks(" ") or sequences of character enclosed with double quotation (" "). The strings with Single quotes ( ' ) are not valid.


	Example:
		{

			"name" : "Anu"

		}

Also includes escaped characters. Following are the list of backslash-escaped characters that are supported by JSON Strings.

\"Double Quotation
\\Backslash
\/Forward slash
\bBackspace
\fForm feed
\rCarriage return
\nNewline
\tTap
\uHexadecimal digits

Boolean:

The boolean value can be either True or False which is not surrounded by quotes.


	Example:

		{

			"account" : True

		}

Object:

The object in JSON is an unordered collection of name/value pairs.

	Example:
		{

			"Student": { "name":" Aruna "," Roll NO " : "1235"," Dept ":" MBA "}

		}

Array:

It is an ordered collection of values.

	Example:

		{

			"Rate":[120,350,100]
			"Color":["Red"," Blue ","Black ","Yellow "]

		}

Null:

Null means no values/empty. If no value is assigned to any keys, it can be treated as a null type.

	Example:

		{

			"Card":null,
			"Rank": , (null value is assigned automaticaly)
			"name":"Krish"

		}

<<Previous - JSON Syntax

Next - JSON vs XML >>