How to convert a string to JSON ?

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/10 11:22 UTC
Read the original article Hit count: 160

Filed under:

How can I convert a string to JSON in javascript, is there a method that does that?

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