Last active
July 27, 2019 19:00
-
-
Save lmzach09/0b5a509a5447e8660b295d9b8fd44fab to your computer and use it in GitHub Desktop.
Stringify a JS object to JSON string with 4 spaces formatting
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
let obj = { "key": "value" }; | |
let myString = JSON.stringify(obj, null, 4); // 4 space indentations | |
console.log(myString); | |
// { | |
// "key": "value" | |
// } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment