JSON
The Json
objejct contains methods for parsing JavaScript Object Notation (JSON)
and converting values to JSON. It can't be called or constructed, and
aside from its two method properties, it has no interesting
functionality of its own.
What is 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
Why use JSON
- JSON format is text only
- Easily be sent to and from a server
- Used as a data format by any programminglanguage
JSON Syntax Rules
JSON syntax is derived from JavaScript object notation syntax:- Data is in name/value pairs
- Data is separated by commas
- Curly braces hold objects
- Square brackets hold arrays
JSON Values
In JSON, values must be one of the following data types:- a string
- a number
- an object (JSON object)
- an array
- a boolean
- null
In JavaScript values can be all of the above, plus any other valid JavaScript
expression, including:
- a function
- a date
- undefined
JSON Uses JavaScript Syntax
Because JSON syntax is derived from JavaScript object notation, very little extra software is needed to work with JSON within JavaScript.JavaScript Arrays as JSON
The same way JavaScript objects can be used as JSON, JavaScript arrays can also be used as JSON.Valid Data Types
In JSON, values must be one of the following data types:- a string
- a number
- an object (JSON object)
- an array
- a boolean
- null
Object Syntax
JSON 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).
Keys and values are separated by a colon.
Each key/value pair is separated by a comma.
learn more:- https://www.w3schools.com/js/js_json_intro.asp
https://www.json.org/
Thank you