BugsDB
All Questions

JSON Tutorial

The JSON: the JavaScript Object Notation

JSON is the syntax for storing and exchanging text information. Similar to XML.

JSON is smaller, faster, and easier to parse than XML.

JSON example

This sites object is an array containing 3 site records (objects).

{
    "sites":[
        {
            "name":"bugsdb",
            "url":"www.bugsdb.com"
        },
        {
            "name":"google",
            "url":"www.google.com"
        },
        {
            "name":"facebook",
            "url":"www.facebook.com"
        }
    ]
}

What is JSON?

  • Refers JSON JavaScript Object Notation
  • JSON is a lightweight text data interchange format
  • JSON is language independent: JSON uses Javascript syntax to describe data objects, but JSON is still language and platform independent. The JSON parser and JSON library support many different programming languages. Currently, many dynamic (PHP, JSP, .NET) programming languages ​​support JSON.
  • JSON is self-describing and easier to understand

JSON-Convert to JavaScript Object

The JSON text format is syntactically the same as the code that creates JavaScript objects.

Because of this similarity, no parser is required, and JavaScript programs can use the built-in eval () function to generate native JavaScript objects from JSON data.