This Angular tutorial helps you get started with Angular quickly and effectively through many practical examples.

JSON Parse

JSON Parse

JSON parsing is the process of converting a JSON object in text format to a Javascript object that can be used inside a program. Suppose you make a API project which return JSON Object. when You will recieve that JSON data from a web server, the data is always a string. Parse the data with JSON.parse(), and the data becomes a JavaScript object.

Json stringify


Suppose we have a web API and it is uploaded on web server. So we received this text from a web server:

'{"name":"Rohatash", "age":36, "Email":""}'

Use the JavaScript function JSON.parse() to convert text into a JavaScript object:

const parseobj = JSON.parse('{{"name":"Rohatash", "age":36, "Email":""}}');

The below example you can use on HTML page


<h2>JavaScript Object from a JSON String</h2>

<p id="parsetestid"></p>

const jsontxt = '{"name":"Rohatash", "age":36, "Email":""}'
const obj = JSON.parse(jsontxt);
document.getElementById("parsetestid").innerHTML = + ", " + obj.age + ", " + obj.Email;


Now run the code on browser. The following output will show:


Json stringify

Prev Next