Skip to content

Instantly share code, notes, and snippets.

@aaira-a
Created January 20, 2023 16:37
Show Gist options
  • Save aaira-a/f303c93491650af33725d33ccd0d3753 to your computer and use it in GitHub Desktop.
Save aaira-a/f303c93491650af33725d33ccd0d3753 to your computer and use it in GitHub Desktop.
Prettify json file using nodejs
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