Answer the question
In order to leave comments, you need to log in
How to push to json file?
There is a json file. I want to push into it
prize.push({
id: my.Id
})
setInterval(async () => {
fs.writeFileSync("./myJson.json", JSON.stringify(prize, null, "\t"))
}, 500);
Answer the question
In order to leave comments, you need to log in
You can't use JSON in this way. It is a data representation format , not a storage format.
Use databases - SQLite, for example. This is a very lightweight database and does not require a lot of knowledge from you.
Even easier to interact with it can help any available ORM.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question