Latest web development tutorials

JSON Tutorial


JSON: J ava S cript O bjectN otation (JavaScript Object Notation)

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

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

JSON examples

{
"employees": [
{ "firstName":"John" , "lastName":"Doe" },
{ "firstName":"Anna" , "lastName":"Smith" },
{ "firstName":"Peter" , "lastName":"Jones" }
]
}

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 Notation)
  • JSON is a lightweight data interchange format text
  • JSON language independent *
  • JSON self-descriptive and easier to understand
* Javascript use JSON syntax to describe data objects, but JSON is still independent of language and platform. JSON parser and JSON library supports many different programming languages. Currently a lot of dynamic (PHP, JSP, .NET) programming languages ​​support JSON.

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.