This content originally appeared on DEV Community 👩💻👨💻 and was authored by Mahmoud EL-kariouny
What is JSON?🤔
JSON (JavaScript Object Notation) is a lightweight data-interchange format.
JSON is easy for humans to read and write, yet it is efficient enough for computers to handle.
JSON is commonly used for transmitting data in web applications (e.g., sending some data from the server to the client, or passing state information between the two) and for serializing structured data into a string representation.
It can be used to represent numbers, strings, booleans, arrays, objects, and raw bytes in a standardized way.
JSON is often used to output data in the Web API's response body.
Advantages of using JSON
JSON is an open standard that enables data to be exchanged between applications without the need for a middleman.
JSON is easy for humans to read and write, which makes it ideal for data exchange between different applications.
JSON is more compact than XML, and therefore easier to transmit.
It is supported by all programming languages.
It can be used on all platforms.
It is a light weight database standard, so data transmission is fast.
Where JSON is used?
JSON is used as the data format for many web services and APIs, such as GitHub, Netflix, Twitter and Facebook
Mobile Applications
Gaming API's
Data types supported
- String
- Number
- Arrays
- Null
- Boolean
- Object
JSON methods in JavaScript
JSON.parse(): Takes JSON string and convert into JavaScript object.
JSON.stringify(): Convert JavaScript object JSON into JSON string useful while sending over the network.
Syntax and Example
{
"squadName": "Super hero squad",
"homeTown": "Metro City",
"formed": 2016,
"secretBase": "Super tower",
"active": true,
"members": [
{
"name": "Molecule Man",
"age": 29,
"secretIdentity": "Dan Jukes",
"powers": ["Radiation resistance", "Turning tiny", "Radiation blast"]
},
{
"name": "Madame Uppercut",
"age": 39,
"secretIdentity": "Jane Wilson",
"powers": [
"Million tonne punch",
"Damage resistance",
"Superhuman reflexes"
]
},
{
"name": "Eternal Flame",
"age": 1000000,
"secretIdentity": "Unknown",
"powers": [
"Immortality",
"Heat Immunity",
"Inferno",
"Teleportation",
"Interdimensional travel"
]
}
]
}
Connect with Me 😊
This content originally appeared on DEV Community 👩💻👨💻 and was authored by Mahmoud EL-kariouny

Mahmoud EL-kariouny | Sciencx (2022-10-14T01:17:06+00:00) Learn JSON from Scratch. Retrieved from https://www.scien.cx/2022/10/14/learn-json-from-scratch/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.