Skip to main content

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(MainConfig, payload)
assert config == MainConfig(ServerConfig('127.0.0.1'))

Copyright © 2020 – Niklas Rosenstein

Project details


Release history Release notifications | RSS feed

This version

1.1.2

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.2.tar.gz (10.0 kB view hashes)

Uploaded Source

Built Distribution

databind.json-1.1.2-py3-none-any.whl (13.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page