Most of the time, when we send and receive data, we use the JSON format.
JSON stands for JavaScript Object Notation. It is similar to a JavaScript object.
The difference is:
- JSON properties and values must be wrapped with double quotes (like
"this"). - JSON values must be strings
- You cannot have comments in JSON files
Here’s an image of a JavaScript object and a JSON value.
You can convert a JavaScript object to JSON with JSON.stringify().
const jsonValue = JSON.stringify(javaScriptObj)You can convert a JSON value back into a JavaScript object with JSON.parse
const javaScriptObject = JSON.parse(jsonObj)That’s all you need to know about JSON!
Let’s move on to the next lesson.
Welcome! Unfortunately, you don’t have access to this lesson. To get access, please purchase the course or enroll in Magical Dev School.
Unlock this lesson