JSON Define and Defination

 


What is JSON?

JSON stands for JavaScript Object Notation is an open stand file format for sharing data. Web developers easily write and understand the JSON file data. It helps exchange data between the browser(client) and server, that time JSON data must be in text based on key-value pairs. It use the .json extension when it is standing alone.


Why user JSON? 

JSON using text format and its easy to understand, 

it also sent to server and received from the server in readable format. Useful for any programming language like javascript, PHP, etc. 

1. It’s Lightweight 

2. Easy to write/ read

3. Language Independent 

4. Integrated easily with most of the languages

5. Text based. 

JSON Data Type 

1. String : JSON String written in double qutoes. 

2. Number : JSON Number be an integer and not written in double qutoes like string. 

3. Object : JSON Object are written inside of curly ({ }) braces. 

4. Array : JSON Array are written inside of square ([ ]) braces. 

5. Boolean : Ture or False

6. Null : empty type

JSON Methods 

JSON.parse

When using any Api or received data from web server, the comes alway into string. Using the JSON.parse the data translate or become into javascript object. 

var json = ‘{“result”:true, “counting”:50}’;

var obj = JSON.parse(json);

console.log(obj.counting);

// browser console output: 50

JSON.stringify

JSON.stringify method that converts JavaScript Object or value to JSON string. 

When data sending to a web server, the data has to a string. Converting into Object to string using JSON.stringify. 

console.log(JSON.stringify({ x: 5, y: 6 }));

// Console output: “{“x”:5,”y”:6}”


For More Details read below blog 

http://myfreeonlinetools.com/blog/json-what-it-is-why-use-it-data-types-methods/



Comments

Popular posts from this blog

React Tutorial : Create Article DIV, Heading, Sub Heading & Paragraph