Tuesday, January 8, 2019

JSON


➤JSON: JavaScript Object Notation.
➤It is a syntax for storing and exchanging data.
➤JSON is text, written with JavaScript object notation al with in inverted commas.
➤JSON is "self-describing" and easy to understand. It is language independent.It format is text only.
➤Easily be sent to and from a server.Used as a data format by any programming language.
➤There  are two ways to represent data
         ➣Stringyfy: It converts the Javascript data into string form.
                       var myObj = { "name:" "John", "age:" 31, "city:" "New York" };
      
         ➣Phase: It converts stringy form to normal javascript format.
                      'var myObj = { "name:" "John", "age:" 31, "city:" "New York" };'

If you receive data in JSON format, you can convert it into a JavaScript object:
var myJSON = '{"name":"John", "age":31, "city":"New York"}';
var myObj = JSON.parse(myJSON);

document.getElementById("demo").innerHTML = myObj.name;


When storing data, the data has to be a certain format, and regardless of where you choose to store it, text is always one of the legal formats. JSON makes it possible to store JavaScript objects as text. var myObj, myJSON, text, obj; 
// Storing data: myObj = { name: "John", age: …

No comments:

Post a Comment

React React  is a JavaScript library for building user interfaces created by Facebook. It is maintained by Facebook and a community of...