Converting a string to JSON object

Solution 1:

var obj = JSON.parse(string);

Where string is your json string.

Solution 2:

You can use the JSON.parse() for that.

See docs at MDN

Example:

var myObj = JSON.parse('{"p": 5}');
console.log(myObj);

Solution 3:

var obj = jQuery.parseJSON('{"name":"John"}');
alert( obj.name === "John" );

link:-

http://api.jquery.com/jQuery.parseJSON/