How to convert a JSON string to an object?

Posted by BrunoLM on Stack Overflow See other posts from Stack Overflow or by BrunoLM
Published on 2010-06-10T11:17:12Z Indexed on 2010/06/11 12:12 UTC
Read the original article Hit count: 181

Filed under:
|
|

How can I convert a JSON string to an object in JavaScript? Is there a method that does this?

Something like:

var x = "{  id: 5, name: 'hello'  }";
var y = /*something*/(x);

alert(y.id + " " + y.name);

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery