Skip to content

Instantly share code, notes, and snippets.

@Qard
Created April 9, 2011 10:36
Show Gist options
  • Save Qard/911297 to your computer and use it in GitHub Desktop.
Save Qard/911297 to your computer and use it in GitHub Desktop.
JSON.stringify that retains functions. Simple, but handy.
JSON.fstringify = function(object) {
return JSON.stringify(object, function(key, value){
if (typeof value == 'function') {
return value.toString();
}
return value;
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment