Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

json
stringify
js
javascript
parse

What is JSON.parse in JavaScript?

Educative Answers Team

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

JavaScript Object Notation (JSON) is a light-weight data storage format for storing and transmitting data, stored in the form of key-value pairs. What sets JSON apart from other data formats is its human-readable and self-describing properties.

svg viewer
Data in JSON format

What does the JSON.parse method do?

Most of the times, the data given is not in JSON format and must be converted into JSON before you can use it. That’s where the JSON.parse method comes into play. It converts a JSON string to a JSON object, which can then be used, changed and stored to a JSON file.


Example

Let’s see how we can use the JSON.parse method to convert a string, data, into a JSON object.

var data = '{"platform": "Educative", "established": 2015}';
json = JSON.parse(data);
console.log(json.platform); // expected output: Educative
console.log(json.established); // expected output: 2015

RELATED TAGS

json
stringify
js
javascript
parse
Copyright ©2022 Educative, Inc. All rights reserved

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring