Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // input file dico.json output file data.json
- var arr;
- var fs = require('fs');
- fs.readFile('dico.json',function(err,content){fs.writeFile("data.json",JSON.stringify({'word':cleanArray(JSON.parse(content).words)}),function(err){if(err){ throw err;};});})
- function cleanArray(arra) {
- var i, j, len = arra.length, out = [], obj = {};
- for (i = 0; i < len; i++) {
- obj[arra[i]] = 0;
- }
- for (j in obj) {
- out.push(j);
- }
- return out;
- }
Add Comment
Please, Sign In to add comment