Created
February 26, 2017 10:24
-
-
Save iddan/3d34b12f6b22c30a8a07c149b3175e2f to your computer and use it in GitHub Desktop.
Convert JSON5 to JSON
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'); | |
const JSON5 = require('json5'); | |
const [file] = process.argv.slice(2); | |
fs.writeFileSync( | |
file.replace(/\.json5$/, '.json'), | |
JSON.stringify( | |
JSON5.parse( fs.readFileSync(file) ), | |
null, | |
' ' | |
) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That was obvious but i realized it just right now.