Skip to main content

This is a simple I/O JSON handler that allows direct operations on JSONs and with a single call to `JsonDB.flushAll`you can save them all on permanent memory.

Project description

JsonDB

This is a simple I/O JSON handler that allows direct operations on JSONs and with a single call to JsonDB.flushAllyou can save them all on permanent memory.

Example

from JsonDB import JsonDB

class Foo:
    def __init__(self):
        self.db = JsonDB("Foo.json", {"param1": [1,2,3,4], "param2": {"a": 1, "b": 2}})
        self.params = self.db.getJSON()

    def changeParam1(self, value):
        self.params["param1"] = value

    def changeParam2(self, value):
        self.params["param2"] = value

foo = Foo()

foo.changeParam1([1,2,3])
foo.changeParam2(14)

# Save all JSON on respective files
JsonDB.flushAll()

Tests

Automated tests can be run with pytest-3 test.py.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

JsonDB-labm1997-0.0.3.tar.gz (2.3 kB view hashes)

Uploaded Source

Built Distribution

JsonDB_labm1997-0.0.3-py3-none-any.whl (15.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page