JSON is used because it is a lightweight, easily parsed, cross-platform data representation format. There are a multitude of libraries and tools designed to help developers work efficiently with data represented in JSON format, on every platform and every conceivable language and application framework, including, of course, most web browsers.
JSON supports the same basic types as supported by JavaScript, these are:
Number (either integer or floating-point).
JavaScript supports a maximum numerical value of 2 53 . If you are working with numbers larger than this from within your client library environment (for example, 64-bit numbers), you must store the value as a string.
String — this should be enclosed by double-quotes and supports Unicode characters and backslash escaping. For example:
"A String"
Boolean — a true or
false value. You can use these strings
directly. For example:
{ "value": true}Array — a list of values enclosed in square brackets. For example:
["one", "two", "three"]Object — a set of key/value pairs (i.e. an associative array, or hash). The key must be a string, but the value can be any of the supported JSON values. For example:
{ "servings" : 4, "subtitle" : "Easy to make in advance, and then cook when ready", "cooktime" : 60, "title" : "Chicken Coriander" }
If the submitted data cannot be parsed as a JSON, the information will be stored as a binary object, not a JSON document.