Advertisement

JSON Tutorial

JSON: JavaScript Object Notation (J ava S cript O bject N otation).

JSON syntax to store and exchange text messages. Similar to XML.

JSON is smaller than the XML, faster, easier to resolve.

Examples used in each chapter

{
"employees": [
{ "firstName":"Bill" , "lastName":"Gates" },
{ "firstName":"George" , "lastName":"Bush" },
{ "firstName":"Thomas" , "lastName":"Carter" }
]
}

This employee is an object that contains an array of three employee records (objects).

What is JSON?

  • JSON refers to the JavaScript Object Notation (J ava S cript O bject N otation)
  • JSON is a lightweight data interchange format text
  • JSON language independent *
  • JSON self-descriptive and easier to understand

* JSON using JavaScript syntax to describe data objects, but JSON is still independent of language and platform. JSON parser and JSON library supports many different programming languages.

JSON - JavaScript object converted

JSON text in JavaScript syntax to create objects with the same code.

Because of this similarity, without parser, JavaScript program can use the built-in eval () function , with the JSON data to generate a native JavaScript object.