java script json in detail

Json (javascript object notation ) is a lightweight human readable data interchange format-commonlyused for transmitting and storing data.

It is widely used in web application and has become a popular choice for representing structure data.

Json syntax is derived from js ,but it is langaunge-independent,meaning it can be used with any programming langauge.it uses keys-value pairs to organize data into hierarchical structure.

JSON-Object

An object is an unordered collection of key values pairs enclosed in curly braces{}

Each key is a string,followed by a colon:,and then a value.The key value pairs are separated by commas. Object allow you to the represent complex data structure.

{

name: "Abhijeet",

year: 2002

city: "DELHI"

},

JSON-ARRAY:-

An array is an ordered of collection of values enclosed in square brackets[].

Values in an array can be of any valid JSON type, including object,arrays ,numbers,string,booleans,and null.

Array elements are seprated by commas.

[ "apple", "banana", "orange"]

JSON-Different values

String:-

String values shouls be enclosed in double quotes(") . Sinle quotes(') are not considered valid for defining string values in json.

"hello, Abhijeet"

NUMBERS:-JSON doesn't differentiate between different number format (e.g, integars,floats,scientific notation).

1253,115.5

Boolean:- true,false

NULL:- null

➜JSON-Nested Structure:-

JSON allow nesting of object and array within each other to represent more complex data structures.

{

name: "abhijeet",

year: 2023,

address: {

street: "laxmi nagar delhi",

city: "Delhi"

},

hobbies: ["travelling" "cricket"],

}