1

For reference the code below writes a single array in a JSON file:

fs.writeFileSync(
    "./users.json",
    JSON.stringify(filteredArray),
    "utf-8",
    (err) => {
      console.log(err);
    }
  );

And it writes to the JSON file something like this: enter image description here

But now I have a JSON file like this:

{
    "array1": [],
    "array2": [],
    "array3": [],
    "array4": [],
    "array5": [],
    "array6": [],
    "array7": [],
    "array8": [],
    "array9": [],
    "array10": [],
    "array11": [],
    "array12": []
}

How can I write to this file using a node js script?

Serenity
  • 125
  • 6

0 Answers0