Skip to content

Instantly share code, notes, and snippets.

@thiphariel
Forked from composite/json.stringify.js
Last active August 29, 2015 14:07
Show Gist options
  • Select an option

  • Save thiphariel/a68f99a4a47b04b5a4cb to your computer and use it in GitHub Desktop.

Select an option

Save thiphariel/a68f99a4a47b04b5a4cb 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