Created
January 20, 2023 16:37
-
-
Save aaira-a/f303c93491650af33725d33ccd0d3753 to your computer and use it in GitHub Desktop.
Prettify json file using nodejs
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
const fs = require('fs'); | |
let rawdata = fs.readFileSync('input.json'); | |
let parsed = JSON.parse(rawdata); | |
let prettified = JSON.stringify(parsed, null, " "); | |
fs.writeFileSync('output.json', prettified); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment