Skip to content

Instantly share code, notes, and snippets.

@englishextra
Created October 1, 2016 19:30
Show Gist options
  • Save englishextra/4c0c2dec65953cae0d3b909ee64650f7 to your computer and use it in GitHub Desktop.
Save englishextra/4c0c2dec65953cae0d3b909ee64650f7 to your computer and use it in GitHub Desktop.
parse JSON with no eval using JSON-js/json_parse.js
/*!
* 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