/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function parseJSON(json){ try{ if(/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test(json)){ var j = eval('(' + json + ')'); return j; } }catch(e){ } throw new SyntaxError("parseJSON"); }
URL: http://www.json.org/js.html