Is it possible to edit a JSON file locally?

Asked

Viewed 788 times

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?

  • 2

    for security reasons the browser does not alter local data, but you can save the json in localStorage and make changes to it

  • 1

    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.

  • 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.

  • is possible with Node. There is the npm module jsonfile.

  • 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

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.