JSON
- JavaScript Object Notation.
- JSON is a syntax for storing and exchanging data
- JSON is text, written with JavaScript object notation.
Use of Json
- Exchanging Data
- Sending Data
- Receiving Data
- Storing Data
Json syntax
- Syntax Rules
- Data is in name/value pairs
- Data is separated by commas
- Curly braces hold objects
- Square brackets hold arrays
JSON Values
- string
- number
- object (JSON object)
- array
- boolean
- null
Data Types
- a string
- a number
- an object (JSON object)
- an array
- a boolean
- null
JSON.parse()
- A common use of JSON is to exchange data to/from a web server.
- Parse the data with JSON.parse(), and the data becomes a JavaScript object.
JSON.stringify()
- Convert a JavaScript object into a string with JSON.stringify().
JSON Objects
- objects are surrounded by curly braces {}.
- JSON objects are written in key/value pairs.
- Keys must be strings, and values must be a valid JSON data type (string, number, object, array, boolean or null).
Arrays
- Arrays in JSON are almost the same as arrays in JavaScript.
- In JSON, array values must be of type string, number, object, array, boolean or null.
Image : Json file - Free interface icons
No comments:
Post a Comment