I'm currently developing a calendar software and I want to store events in a JSON file. My strategy involves nesting arrays within arrays in the JSON format, allowing for easy iteration and loading during program initialization.
My main question is: how can I add an array into another array in JSON? Any tips on this issue? For instance, if I have a variable var event
containing an array such as
{"id": elementTitle, "year": year, "month": month, "day": day};
which will be stringified using JSON.stringify(event)
, how do I append it to an existing array in a JSON file like: events = { }
.
Just to add, this application is built using the electron API and powered by node.js.