Skip to content
Advertisement

How to read and write JSON offline on local machine?

Problem

I need a way to store and collect JSON data in an entirely offline(!) web application, hosted on a local (shared) machine. Several people will access the app but it will never actually be online.

I’d like the app to:

  • Read and write JSON data continuously and programmatically (i.e. not using a file-upload type schema)
  • Preferably not require any software installation other than the browser, specifically I’d like not to use local server. (edit: I may be willing to learn a bit of Python if that helps)
  • The amount of data I need to store is small so it is very much overkill to use some sort of database.

Solution?

My first thought was to let the html5 file API, just read/parse and write my JSON object to a local txt file, but this appears not to be possible?!

Local storage is not applicable here right, when several people – each with their own browser – need to access the html?

Any ideas?

note

I know this topic is not entirely novel, but I think my situation may be slightly different than in other threads. And I’ve spent the better part of the last couple hours googling this and I’m none the wiser..

Advertisement

Answer

Have you considered Python’s Json module? http://docs.python.org/2/library/json.html

Using this you can convert python objects to and from json strings. You can store the strings however you want to

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement