Skip to main content

databind.json

The databind.json package implements the de-/serialization to or from JSON payloads using the databind.core framework.

Check out the Documentation for examples.

Built-in converters

The following tables shows which types can be deserialized from / serialize to Python types with the native converters provided by the databind.json module:

Converter name Types Description
AnyConverter typing.Any Accept any value (useful for arbitrary JSON).
CollectionConverter typing.Collection[T], excl. str, bytes, bytearray, memoryview and typing.Mapping[K, V] Converts between native Python collections and JSON arrays.
DatetimeConverter datetime.date, datetime.datetime, datetime.time Converts between strings and date/time formats, using ISO 8601 time format by default (can be changed with the databind.core.settings.DateFormat setting).
DecimalConverter decimal.Decimal Converts between strings (and ints/floats if strict mode is off, strict mode is on by default) and decimals. The precision can be controlled with the databind.core.settings.Precision setting.
EnumConverter enum.Enum, enum.IntEnum Convert between strings and Python enumerations. The serialized form of IntEnum is the integer value, whereas the serialized form of Enum is a string (name of the enumeration value).
MappingConverter typing.Mapping[K, V] Converts between Python dicts and JSON objects. (While in theory K can be any type, for JSON K always needs to be str).
OptionalConverter typing.Optional[T] Handles optional fields in a schema.
PlainDatatypeConverter bytes, str, int, float, bool Converts between plain datatypes. In non-strict mode (off by default), numeric types will also accept strings as input for the deserialization.
SchemaConverter dataclasses.dataclass, typing.TypedDict Converts between Python dataclasses or typed dictionary and JSON objects.
UnionConverter typing.Union[...] Handles union types. Unions in JSON can be expressed in a multitide of ways, e.g. using a discriminator key and flat, keyed or nested structure or "best match". Check out the examples section of the documentation for more information.
LiteralConverter typing.Literal[...] Accepts or rejects a value based on whether it matches one of the values in the literal type hint.

The following converters are provided for convenience:

Converter name Types Description
StringifyConverter n/a A helper that allows to easily create de/serializers from a "to string" and "from string" function.

The following additional types are natively supported by databind.json using StringifyConverter:

Types Description
uuid.UUID Convert between strings and UUIDs.
pathlib.Path Convert between strings and paths.
pathlib.PurePath Convert between strings and paths.
nr.date.duration Deserialize from ISO 8601 duration strings or the object form, serialize to ISO 8601 strings.

Copyright © 2020 – Niklas Rosenstein

Metadata

Release files for databind.json 4.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for databind.json 4.3.2
File Size Uploaded Provenance Actions
databind.json-4.3.2.tar.gz 17.5 kB Without provenance Details for databind.json-4.3.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for databind.json 4.3.2
File Interpreter ABI Platform Actions
databind.json-4.3.2-py3-none-any.whl Python 3 none any Details for databind.json-4.3.2-py3-none-any.whl

Total release size: 34.9 kB

Release files / databind.json-4.3.2.tar.gz

Download URL databind.json-4.3.2.tar.gz
Size 17.5 kB
Tags Source
SHA-256 checksum
How to use checksums
905d5f35c512925f55561eca517fcd50ff0d5af99e86b9e0827dbd9d3e4b7f9c
BLAKE2b-256 checksum
How to use checksums
b81e63f053364644314d6ed7dc0fd6d9f06427d1bd39c26c67674bbbf1ef4fc2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.9.6 readme-renderer/37.3 requests/2.28.2 requests-toolbelt/0.10.1 urllib3/1.26.14 tqdm/4.64.1 importlib-metadata/6.0.0 keyring/23.13.1 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.9

Release files / databind.json-4.3.2-py3-none-any.whl

Download URL databind.json-4.3.2-py3-none-any.whl
Size 17.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
87241b0cf5cd8f9ce468f47e80bfa5921cb51a3993465e0730ae5d432de136f2
BLAKE2b-256 checksum
How to use checksums
6edcacb646389bea3fea9df8ca12e76023dedead06dbeb9a889ceab510bdc3dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.9.6 readme-renderer/37.3 requests/2.28.2 requests-toolbelt/0.10.1 urllib3/1.26.14 tqdm/4.64.1 importlib-metadata/6.0.0 keyring/23.13.1 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.9

Security for databind.json 4.3.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Release history Release notifications | RSS feed

This release

4.3.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page