Created
February 8, 2018 01:38
-
-
Save Pepijn98/062f4223deee0d445f8f4aeca1e4081f to your computer and use it in GitHub Desktop.
Re-format some "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 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