De-/serialize Python dataclasses to or from JSON payloads. Compatible with Python 3.7 and newer.
Project description
databind.json
The databind.json
package implements the de-/serialization to or from JSON payloads using
the databind.core
framework.
Quickstart
import databind.json
import dataclasses
@dataclasses.dataclass
class ServerConfig:
host: str
port: int = 8080
@dataclasses.dataclass
class MainConfig:
server: ServerConfig
payload = { 'server': { 'host': '127.0.0.1' } }
config = databind.json.load(payload, MainConfig)
assert config == MainConfig(ServerConfig('127.0.0.1'))
Copyright © 2020 – Niklas Rosenstein
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
databind.json-1.1.6.tar.gz
(10.1 kB
view hashes)
Built Distribution
Close
Hashes for databind.json-1.1.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63dabd95d831525a0971774cda2852296bf51b5af5b4c518ecef52de7ffe157d |
|
MD5 | 4634878e416882aaaa3ccf85e9fb36c0 |
|
BLAKE2b-256 | c7e2b1aa7ae569f309fc4556c5a3c6103903c313e0c2b20a7b07e7daf5ddd321 |