JSON

From Computer Science Wiki
Web Science[1]

JSON, it is an open-standard file format that uses human-readable text to transmit data objects consisting of attribute–value pairs and array data types.

{
  "firstName": "Orest",
  "lastName": "Smith",
  "isAlive": true
}

# In the example above, firstname is an attribute, and the value is "Orest".

JSON (JavaScript Object Notation) is an open standard file format and data interchange format that uses human-readable text to store and transmit data objects consisting of attribute–value pairs and arrays (or other serializable values). It is a common data format with diverse uses in electronic data interchange, including that of web applications with servers.

JSON is a language-independent data format. It was derived from JavaScript, but many modern programming languages include code to generate and parse JSON-format data. JSON filenames use the extension .json.[2]

Example 1 - String Value Application
JS: { name : 'Orest' }
JSON: { "name" : "Orest" }

Example 2 - Data Types
a. Number
b. String
c. Boolean
d. Array
e. Object
f. Null

Example 3 - Short Biography of a Person in short facts
{
  "firstName": "Orest",
  "lastName": "Smith",
  "isAlive": true,
  "age": 27,
  "address": {
    "streetAddress": "21 2nd Street",
    "city": "New York",
    "state": "NY",
    "postalCode": "10021-3100"
  },
  "phoneNumbers": [
    {
      "type": "home",
      "number": "123 654-7809"
    },
    {
      "type": "office",
      "number": "098 765-4321"
    },
    {
      "type": "mobile",
      "number": "123 456-7890"
    }
  ],
  "children": [],
  "spouse": null
}

Example 4 - Parsing JSON in JS
var p = JSON.parse(json_string);

References[edit]