I know how to get value from a local json file from files folder. But how can I update same json files from game? Like I have a author with some books name. I want to add some new books to the same file with the same author. How can I do that?
Please help. Thanks.
You can not modify project files from runtime. You need to read the file on the first run, change or add new books and save the data to Local Storage for example. Next time, if Local Storage item exists, get it from Local Storage instead of the project file.
But of course, this method will only work for one user. If you want to add books for all users, you need some kind of online database.
Develop games in your browser. Powerful, performant & highly capable.
As dop2000 says you cannot modify project files from within your game. This doesn't stop you from being able to keep your changes though.
If you want to modify the files only for that user, you can save your changes to localstorage. When the game starts you can check if a revision exists in localstorage and load that instead of the project file.
If you want to actually put your changes back into the project the easiest way is to download the JSON object from your game, and then back in the editor replace the project file with the JSON file you have just downloaded. This basically makes your game a custom authoring tool for that file.