import { createRequire } from "module"; const require = createRequire(import.meta.url); const fs = require("fs"); const { username } = require("./username.json"); console.log(username.length); const newarray = []; for (let index = 0; index < username.length; index++) { delete username[index].frec_pri; delete username[index].frec_seg; delete username[index].freq_rep; newarray.push(username[index]); } console.log(newarray); let data = JSON.stringify(newarray); fs.writeFileSync("allnames.json", data);
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter