Created
July 15, 2014 06:27
-
-
Save JohannesHoppe/82c1ae49666bb84a3a4b to your computer and use it in GitHub Desktop.
JavaScript-stringify with support for U+2028 and U+2029 characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var saveStringify = function (obj) { | |
return JSON.stringify(obj) | |
.replace(/\u2028/g, '\\u2028') | |
.replace(/\u2029/g, '\\u??2029'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment