Total Post:113

 215  View(s)
Rate this:

What is Json ? explain its functionality ?

  1. Post:140

    Re: Json

    JSON :

    JSON stands for JavaScript Object Notation.

    JSON is a lightweight data-interchange format .

    JSON is "self-describing" and easy to understand .

    JSON is language independent.

    We can also convert any JSON received from the server into JavaScript objects If you have data stored in a JavaScript object, you can convert the object into JSON, and send it to a server: 

    - Exchanging Data. 

    - Sending Data

    var myObj = { "name":"Prakash", "age":19, "city":"Allahabad" }; 
    var myJSON = JSON.stringify(myObj);
    window.location = "demo_json.php?x=" + myJSON;

    - Receiving Data 

    var myJSON = '{ "name":"Prakash", "age":19, "city":"Allahabad" }'; 
    var myObj = JSON.parse(myJSON); document.getElementById("demo").innerHTML = myObj.name; 

    - Storing Data

    //Storing data in local server:

    myObj = { "name":"Prakash", "age":19, "city":"Allahabad" };
    myJSON = JSON.stringify(myObj);
    localStorage.setItem("testJSON", myJSON);