Skip to main content

A package to read and write json files

Project description

Read Write JSON

Load JSON Settings from file

Write JSON Settings to file

- Read settings file from json format and return it
- Write settings file from json format
- Interactive write in json settings with save option
- Write out json file if file is missing
    - values
        - string, int, float
        - [list], {"dict":"value"}
pip install jsonreadwrite

Todo: Write proper documentation

from jsonreadwrite import JsonReadWrite

testlist = ["test1", "test2", "test3"]
testdict = {"test1": "test1", "test2": "test2", "test3": "test3"}
testint = 1
testfloat = 1.1
testbool = True
testnone = None
testblank = ""

test = JsonReadWrite("test.json",allowempty=True)

test.set("testlist", testlist)
test.set("testdict", testdict)
test.set("testint", testint)
test.set("testfloat", testfloat)
test.set("testbool", testbool)
test.set("testnone", testnone)
test.set("testblank", testblank)

assert test.get("testlist") == testlist
assert test.get("testdict") == testdict
assert test.get("testint") == testint
assert test.get("testfloat") == testfloat
assert test.get("testbool") == testbool
assert test.get("testnone") == testnone
assert test.get("testblank") == testblank
{
      "testlist": [
            "test1",
            "test2",
            "test3"
      ],
      "testdict": {
            "test1": "test1",
            "test2": "test2",
            "test3": "test3"
      },
      "testint": 1,
      "testfloat": 1.1,
      "testbool": true,
      "testnone": null,
      "testblank": ""
}

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

jsonreadwrite-1.0.0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

jsonreadwrite-1.0.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file jsonreadwrite-1.0.0.tar.gz.

File metadata

  • Download URL: jsonreadwrite-1.0.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.13

File hashes

Hashes for jsonreadwrite-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b11c4bbdbcd13c96f009d983c2b1c44f014069a3439e9bee8f00b41a42ae291f
MD5 0f8ac735456944ef03312debba957ce7
BLAKE2b-256 201c95101fad6c9885aa15b0ff2d7880bc53bf09937e84ed274a89125136d0cf

See more details on using hashes here.

File details

Details for the file jsonreadwrite-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for jsonreadwrite-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8c6efc41e60480c3b52233150bb652e46513707ca875b3336dade15cc75344af
MD5 00119d32242286b3459b1186bd211aa7
BLAKE2b-256 808f6403637820a93125cc68fec67490f8dae264b0a31214cb7fb0bf0dec2e3d

See more details on using hashes here.

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