Node JS
JavaScript JSON
The JavaScript JSON is an acronym of JavaScript Object Notation. It provides a format for storing and transporting data. It is a lightweight human readable collection of data that can be accessed in a logical manner.
Points to remember
- It generates and stores the data from user input.
- It can transport the data from the server to client, client to server, and server to server.
- It can also build and verifying the data.
JSON Syntax
1. While working with .json file, the syntax will be like:
{
"First_Name" : "value";
"Last_Name": "value ";
}
2. While working with JSON object in .js or .html file, the syntax will be like:
var varName = {
"First_Name": "value";
"Last_Name": "value ";
}
JavaScript JSON Methods
Let's see the list of JavaScript JSON method with their description.
Methods | Description |
---|---|
JSON.parse() | This method takes a JSON string and transforms it into a JavaScript object. |
JSON.stringify() | This method converts a JavaScript value (JSON object) to a JSON string representation. |