jsonstore
JsonStore maps a JSON object’s keys to Python attributes. Use it to load and save configuration containing nested dictionaries and lists.
Requires Python 3.9 or newer. Tests run on CPython 3.9–3.15 and PyPy 3.11.
Examples
Install with pip install python-jsonstore.
Basics
from jsonstore import JsonStore
# Assignments and deletions are saved automatically.
store = JsonStore("config.json")
store.message = "hello"
store.options = {"enabled": True, "greeting": "💐"}
store.numbers = [1, 2, 3]
assert "message" in store
del store.message
# Dot-separated keys traverse dictionaries.
store["options.enabled"] = False
assert store["options", "enabled"] is False
# Tuple or list paths also accept list indices and slices.
assert store["numbers", -1] == 3
assert store[["numbers", 1]] == 2
del store["numbers", :2]
assert store.numbers == [3]
# A one-element tuple addresses a literal key containing a dot.
store[("literal.key",)] = "value"
Reads and assignments use deep copies. To update a stored collection, assign the modified value back; += also does this:
store.numbers.append(4)
assert store.numbers == [3]
store.numbers += [4, 5]
assert store.numbers == [3, 4, 5]
Use item access for keys that conflict with JsonStore attributes. indent controls JSON formatting and defaults to 2; use None for compact output. auto_commit=False defers saving until a transaction commits.
Transactions
Use with store: to group changes into a transaction. Transactions may be nested; only successful exit from the outermost transaction saves the file. An exception in a transaction restores its previous state, including when saving fails.
from jsonstore import JsonStore
with JsonStore("config.json", indent=None, auto_commit=False) as store:
store.value = 1
assert JsonStore("config.json").value == 1
try:
with store:
store.value = 2
with store:
store.value = 3
raise ValueError("cancel the transaction")
except ValueError:
pass
assert store.value == 1
assert JsonStore("config.json").value == 1
Transactions provide in-memory rollback, with no locking or coordination between writers. Use one writer per file; separate stores do not reload each other’s changes. Atomic replacement does not guarantee durability across a power failure.
Metadata
Release files for python-jsonstore 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| python_jsonstore-2.0.0.tar.gz | 12.4 kB | With provenance | Details for python_jsonstore-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| python_jsonstore-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for python_jsonstore-2.0.0-py3-none-any.whl |
Total release size: 18.1 kB
Release files / python_jsonstore-2.0.0.tar.gz
| Download URL | python_jsonstore-2.0.0.tar.gz |
|---|---|
| Size | 12.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c6f95fe849182240b3e65beb452525d856895b9485618317c1354e97e9a15e7f
|
|
BLAKE2b-256 checksum How to use checksums |
1853af56434f723faa198cf0de0b3452ecfcfebd97295b34d229fc0c0cab1099
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.
Transparency logRelease files / python_jsonstore-2.0.0-py3-none-any.whl
| Download URL | python_jsonstore-2.0.0-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f18d3a7ad645a7c2e7d36028ad6dc8de8d8fde92ff274af871e1f50e4735402b
|
|
BLAKE2b-256 checksum How to use checksums |
56203935b54e88a75d2b23bd3e2e1c63d9fa54d9ca93b65bec34df417da3511a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.
Transparency logSecurity for python-jsonstore 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for python_jsonstore-2.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.