json_database

April 3, 2026 · View on GitHub

Searchable, persistent Python dict database backed by JSON files.

Overview

json_database provides two complementary abstractions built on plain Python dicts:

  • JsonStorage — a dict subclass that transparently loads from and saves to a JSON file, with optional file locking for concurrent access.
  • JsonDatabase — a list-of-records database on top of JsonStorage that supports CRUD operations, recursive search by key or value, and a fluent Query builder for complex filtering.

Both abstractions have XDG-compliant variants that resolve paths according to the XDG Base Directory Specification. An EncryptedJsonStorage variant wraps AES-256-GCM encryption around the plain storage layer.

Key Classes

ClassPurposeSource
JsonStoragePersistent dict backed by a JSON filejson_database/__init__.py:23
EncryptedJsonStorageAES-GCM encrypted variant of JsonStoragejson_database/__init__.py:124
JsonDatabaseSearchable list-of-records databasejson_database/__init__.py:182
JsonStorageXDGJsonStorage placed in XDG cache dirjson_database/__init__.py:398
EncryptedJsonStorageXDGEncryptedJsonStorage in XDG data dirjson_database/__init__.py:418
JsonDatabaseXDGJsonDatabase placed in XDG data dirjson_database/__init__.py:434
JsonConfigXDGJsonStorage placed in XDG config dirjson_database/__init__.py:453
QueryFluent filter builder for JsonDatabasejson_database/search.py:5

Contents