Write / add data in JSON file using Node.js
If this JSON file won’t become too big over time, you should try: Create a JavaScript object with the table array in itvar obj = { table: [] }; Add some data to it, for example:obj.table.push({id: 1, square:2}); Convert it from an object to a string with JSON.stringifyvar json = JSON.stringify(obj); Use fs to write the … Read more