JSON Datatypes

JS Tutorial

JS Version

JS Objects

JS Function

JS Classes

JS Async

JS HTML DOM

JS Browser BOM

JS Web API

JS AJAX

JS JSON

JS vs JQUERY

JS Graphics

JSON Data Types

Valid Data Types

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

  • a string.
  • a number.
  • an object (JSON object).
  • an array.
  • a Boolean.
  • Null.

JSON values cannot be one of the below data types:

  • a function.
  • a date.
  • Undefined.

JSON Strings

Strings in JSON should be written in double quotes.

Example

{“name”:”John”}

JSON Numbers

Numbers in JSON must be integer or a floating point.

Example

{“age”:30}

JSON Objects

Values in JSON can be objects.

Example

{

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

}

Objects as values in JSON must be in  JSON syntax.

JSON Arrays

Values in JSON can be arrays.

Example

{

“employees”:[“John”, “Anna”, “Peter”]

}

JSON Booleans

Values in JSON can be true/false.

Example

{“sale”:true}

JSON null

Values in JSON can be null.

Example

{“middlename”:null}


Notice: ob_end_flush(): failed to send buffer of zlib output compression (1) in /home/u212091429/domains/mydevhelp.com/public_html/wp-includes/functions.php on line 5420

Notice: ob_end_flush(): failed to send buffer of zlib output compression (1) in /home/u212091429/domains/mydevhelp.com/public_html/wp-includes/functions.php on line 5420