Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
JSON.parse() function in JavaScript
The JSON.parse() function accepts a JSON string, and constructs an object based on the given text and, returns it.
Syntax
Its Syntax is as follows
Json.parse();
Example
<html>
<head>
<title>JavaScript Example</title>
</head>
<body>
<script type="text/javascript">
var jsonSample = '{"Tutorial": "Java", "Version":8 }';
jsonObj = JSON.parse(jsonSample);
document.write("Tutorial Name: " + jsonObj.Tutorial);
document.write("<br>");
document.write("Tutorial Version: " + jsonObj.Version);
</script>
</body>
</html>
Output
Tutorial Name: Java Tutorial Version: 8
Advertisements