Skip to content

Instantly share code, notes, and snippets.

@L2L2L
Forked from composite/json.stringify.js
Last active August 29, 2015 14:22
Show Gist options
  • Save L2L2L/398720a78ec69ee8d9a6 to your computer and use it in GitHub Desktop.
Save L2L2L/398720a78ec69ee8d9a6 to your computer and use it in GitHub Desktop.
function JSON_stringify(s, emit_unicode)
{
var json = JSON.stringify(s);
return emit_unicode ? json : json.replace(/[\u007f-\uffff]/g,
function(c) {
return '\\u'+('0000'+c.charCodeAt(0).toString(16)).slice(-4);
}
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment