Created
January 18, 2018 13:40
-
-
Save thyngster/b2c04323c41aa6ff2e955dacb64fa1db to your computer and use it in GitHub Desktop.
Exports object as JSON string keeping undefined values
This file contains hidden or 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
JSON.stringify(obj, function (k, v) { | |
return (v === undefined) ? "undefined" : v | |
}).replace(/\"undefined\"/g,undefined); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment