Registry / serialization / databind-json

databind-json

JSON →
library4.5.5pypypiunverified

The `databind-json` library (version 4.5.4) provided de-/serialization capabilities for Python dataclasses to and from JSON payloads, compatible with Python 3.8 and newer. This package is officially deprecated. Its core functionality has been integrated directly into the `databind` library, specifically within the `databind.json` module. While `databind-json` has received recent maintenance updates, new projects and existing users are strongly advised to migrate to the `databind` package for all serialization needs, benefiting from broader support and continued development.

pip install databind-json
INSTALL
IMPORT
SIG · DATABIND-JSON
D
databind-json
serializationpythonv4.5.5
Install
2.3s avg
Import
Disk
43MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v4.5.5 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.940 runs
installs and imports cleanly · install 0.0s · import 0.000s · 68.6MB
glibc
py 3.103.940 runs
installs and imports cleanly · install 2.3s · import 0.000s · 20MB
43MB installed
● package 43MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

dumps
from databind_json import dumps
loads
from databind_json import loads

Demonstrates basic serialization and deserialization of dataclasses, including handling of `Optional` fields and nested dataclasses, using the `dumps` and `loads` functions from `databind_json`.

from dataclasses import dataclass from typing import Optional, Union from databind_json import dumps, loads @dataclass class Address: street: str city: str @dataclass class User: id: int name: str email: Optional[str] = None address: Optional[Address] = None # Serialize a User object user = User(id=123, name="Alice Smith", email="alice@example.com", address=Address(street="123 Main St", city="Anytown")) json_payload = dumps(user) print("Serialized JSON:", json_payload) # Deserialize a JSON string back into a User object json_string_to_load = '{"id": 456, "name": "Bob Johnson", "email": null, "address": {"street": "456 Oak Ave", "city": "Otherville"}}' deserialized_user = loads(json_string_to_load, User) print("Deserialized User:", deserialized_user) # Example with an optional field not present in JSON (deserializes to None) json_no_address = '{"id": 789, "name": "Charlie Brown"}' user_no_address = loads(json_no_address, User) print("User with no address in JSON:", user_no_address)
Debug
Known issues
breakingThe `databind-json` package is officially deprecated and is no longer the recommended library for JSON serialization of dataclasses. Its functionality has been fully integrated into the `databind` library under the `databind.json` module.
fix
Migrate to the `databind` package. Install using `pip install databind` and update your import statements from `from databind_json import ...` to `from databind.json import ...`.
affects: All versions
gotchaIncorrect handling or complex definitions of `typing.Union` or `typing.Optional` types within dataclass fields can lead to unexpected serialization failures or `RecursionError`. This is especially relevant when `Union` types include `typing.Literal` values or when Union settings are inherited via MRO.
fix
Ensure `Union` types are precisely defined (e.g., more specific types before less specific ones). For `Optional[T]`, use `Union[T, None]`. Upgrade to `databind-json` 4.5.4 (or `databind` 4.5.4) to benefit from recent fixes related to `RecursionError` and `Union` with `Literal` types. Refer to the `databind` documentation for best practices on complex type hints.
affects: <4.5.4 (for RecursionError), <4.5.3 (for Union with Literal)
gotchaDataclasses inheriting from uninstantiated `typing.Generic` types may not have all their fields correctly discovered and serialized. Similarly, complex inheritance structures involving `__databind_settings__` on subclasses can introduce subtle bugs or unexpected behavior.
fix
Upgrade to `databind-json` 4.5.4 (or `databind` 4.5.4). Carefully review dataclass inheritance patterns involving generics, ensuring they are correctly instantiated or that field inference is unambiguous. Consult the `databind` documentation on class settings and inheritance for detailed guidance.
affects: <4.5.3 (for Generic inheritance), <4.5.4 (for __databind_settings__ issues)
Upgrade
Version history
4.5.5latest on PyPI · released May 22, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
10
OpenAI (training)
1
Resources
databind-json — pip install databind-json · libregistry