How to convert JSON string into a JavaScript Object


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. var obj = jQuery.parseJSON('
  2. {"name":"Larry King",
  3. "age": "5000"
  4. }');
  5. alert( obj.name === "Larry King" ); //true
  6. alert (obj.age === "50"); //false
  7. alert (obj.age === "5000"); //true
  8.  

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.