Skip to content

Instantly share code, notes, and snippets.

@Pepijn98
Created February 8, 2018 01:38
Show Gist options
  • Save Pepijn98/062f4223deee0d445f8f4aeca1e4081f to your computer and use it in GitHub Desktop.
Save Pepijn98/062f4223deee0d445f8f4aeca1e4081f to your computer and use it in GitHub Desktop.
Re-format some "json"
const fs = require("fs");
const json = require("./points.json");
let array = [];
Object.keys(json).map((key, index) => {
let temp = {
"userID": key,
"level": json[key].level,
"points": json[key].points,
"blacklisted": 0
};
array.push(temp);
});
fs.writeFile(`${__dirname}/points-new.json`, JSON.stringify(array), (err) => {
if (err) return console.error(err);
console.log("The file was saved!");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment