Json
Json
json -->
- Definition:
Advantages of JSON:
- Human-Readable: JSON's structure is easy for developers to understand and
write.
- Lightweight: JSON is a minimal format that reduces the size of the data
being transmitted.
- Language-Independent: JSON can be used with many programming languages,
including JavaScript, Python, Ruby, Java, etc.
Syntax of JSON:
1. Parsing JSON:
2. Stringifying JSON:
- Converting a JavaScript object into a JSON string.
- Method: `JSON.stringify()`
let obj1 ={
name:"rahul",
age:12,
isStudent:true,
marks : [10,20,30,40]
}
console.log(obj1)
// ! 1. JSON.stringify()
// ! 2. JSON.parse()