Skip to content

Instantly share code, notes, and snippets.

@iddan
Created February 26, 2017 10:24
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iddan/3d34b12f6b22c30a8a07c149b3175e2f to your computer and use it in GitHub Desktop.
Save iddan/3d34b12f6b22c30a8a07c149b3175e2f to your computer and use it in GitHub Desktop.
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,
' '
)
);
@Tomloyo
Copy link

Tomloyo 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