Created
October 1, 2016 19:30
-
-
Save englishextra/4c0c2dec65953cae0d3b909ee64650f7 to your computer and use it in GitHub Desktop.
parse JSON with no eval using JSON-js/json_parse.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
* parse JSON with no eval using JSON-js/json_parse.js | |
* with fallback to native JSON.parse | |
* gist.github.com/englishextra/4c0c2dec65953cae0d3b909ee64650f7 | |
* @param {String} a JSON string | |
* safelyParseJSON(a) | |
*/ | |
var safelyParseJSON=function(a){var w=window;try{return w.json_parse?json_parse(a):JSON.parse(a);}catch(e){console.log(e);}}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment