Parse JSON string without JSON.parse and eval()

sandeepkamboj12

Sandeep kamboj

Posted on July 14, 2018

Parse JSON string without JSON.parse and eval()

    var jsonStr="{name:'abc',age:20}";
    var jsonObject = (new Function( "return " + jsonStr ) )() ;
    console.log(jsonObject);

Enter fullscreen mode Exit fullscreen mode
💖 💪 🙅 🚩
sandeepkamboj12
Sandeep kamboj

Posted on July 14, 2018

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related