Skip to content

Instantly share code, notes, and snippets.

@iddan
Created February 26, 2017 10:24
Convert JSON5 to JSON
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,
' '
)
);
@nmnmrm
Copy link

nmnmrm commented Nov 4, 2023

That was obvious but i realized it just right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment