JSON Introduction

Home > Json Tutorial > JSON Introduction

Best PHP Live Project Based Winter Training in Noida for more details click here



Introducing JSON

  • JSON Stands for JavaScript Object Notation.
  • JSON is used for exchanging and storing data.
  • JSON is an easier to use alternative to XML.
  • JSON is a lightweight data-interchange format.
  • JSON is language independent.
  • JSON is "self-describing" and easy to understand.

JSON example defines Students object with an array of three students:

{"students":[
    {"FirstName":"ravi", "Lastname":"srivastva"},
    {"FirstName":"Anju", "LastName":"Anju"},
    {"FirstName":"Sanjeev", "LastName":"rai"}
]}

The following XML example also defines Students object with 3 students records:


    
        ravi
        srivastva
    
    
        Anju
        Anju
    
    
        Sanjeev
        rai
    

JSON Objects

Inside curly braces write json objects like:

{"Name": "ravi", "Profile":"Student"}

JSON Array

Json array must be written inside square braces. like:

"student":
[
    {"Name":"Ravi", "Course":"PHP"},
    {"Name":"Abhi", "Course":"JAVA"},
    {"Name":"Rexx","Course":"PHP"}
]