Home » JavaScript JSON

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:

2. While working with JSON object in .js or .html file, the syntax will be like:

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.

JavaScript JSON Example

Let’s see an example to convert string in JSON format using parse() and stringify() method.

Test it Now

Output:

Convert string in JSON format using parse() method  XYZ  Convert string in JSON format using stringify() method  {"Name":"Krishna","Email":"XYZ","CN":12345}  
Next TopicJavaScript JSON

You may also like