Skip to content

Instantly share code, notes, and snippets.

@johan--
Created April 11, 2010 18:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johan--/362950 to your computer and use it in GitHub Desktop.
Save johan--/362950 to your computer and use it in GitHub Desktop.
Error: JSON.parse
Source File: http://static.ak.connect.facebook.com/connect.php/en_US/js/Api/CanvasUtil/Connect/XFBML
Line: 31
FB.JSON=function FB_JSON(){};FB.JSON.deserialize=function(b,a){if(FB.Sys.isNullOrEmpty(b))return null;if(a){if(!FB.JSON._64bitIntRegex)FB.JSON._64bitIntRegex=new RegExp('([^\\\\]\"\:)([0-9]{11,20})(,|}|])','gm');b=b.replace(FB.JSON._64bitIntRegex,'$1"$2"$3');}return FB.JSON.parse(b);};if(window.JSON&&typeof JSON.parse==='function'){FB.JSON.parse=JSON.parse;}else FB.JSON.parse=function(text,reviver){var j;function walk(a,c){var b,d,e=a[c];if(e&&typeof e==='object')for(b in e)if(Object.hasOwnProperty.call(e,b)){d=walk(e,b);if(d!==undefined){e[b]=d;}else delete e[b];}return reviver.call(a,c,e);}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;cx.lastIndex=0;if(cx.test(text))text=text.replace(cx,function(a){return '\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);});if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j;}throw new SyntaxError('JSON.parse');};FB.JSON.serialize=function(a){if(FB.Sys.isNullOrUndefined(a))return '';var b=new FB.StringBuilder();FB.JSON._serializeCore(b,a);return b.toString();};FB.JSON._serializeCore=function(j,i){if(FB.Sys.isNullOrUndefined(i)){j.append('null');return;}var k=typeof(i);switch(k){case 'boolean':j.append(i.toString());return;case 'number':j.append((isFinite(i))?i.toString():'null');return;case 'string':j.append(FB.Sys.quote(i));return;case 'object':if(i instanceof Array){j.append('[');var c=i;var h=c.length;var f=true;for(var g=0;g<h;g++){if(typeof(c[g])=='function')continue;if(f){f=false;}else j.append(',');FB.JSON._serializeCore(j,c[g]);}j.append(']');}else if(i instanceof Date){var d=i;var l=Date.UTC(d.getUTCFullYear(),d.getUTCMonth(),d.getUTCDate(),d.getUTCHours(),d.getUTCMinutes(),d.getUTCSeconds(),d.getUTCMilliseconds());j.append('\"\\@');j.append(l.toString());j.append('@\"');}else if(i instanceof RegExp){j.append(i.toString());}else{j.append('{');var f=true;var a=i;for(var b in a){var e={key:b,value:a[b]};if(FB.Sys.startsWith(e.key,'$'))continue;if(typeof(e.value)=='function')continue;if(f){f=false;}else j.append(',');j.append('"'+e.key+'"');j.append(':');FB.JSON._serializeCore(j,e.value);}j.append('}');}return;default:j.append('null');return;}};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment