0
I am beginning to learn how to use JSON and would like to know if it is possible to do operations with it(reading and writing) locally.
Basically a . json file with some data and an.html file.
Is it possible to access this data and include new data in a totally local way? Without having to host on any server?
for security reasons the browser does not alter local data, but you can save the
json
in localStorage and make changes to it– Ricardo Pontual
Beyond the option
localStorage
, you can also use Indexeddb. This is a good solution for "large" files. In addition you can make a system to export/import a file.– Valdeir Psr
Ricardo, but using this localStorage the changes were saved only in it and not in the Json file on my machine, right? For example, if I include a new value my local file will not be changed.
– Hamilton Junior
is possible with Node. There is the npm module
jsonfile
.– tomasantunes
Yes, it is possible. You can use lowdb for this. Follow the link to download and see some examples: https://github.com/typicode/lowdb/tree/master/examples
– Edgar Muniz Berlinck