--- id: typedload version: "2.41" license: GPL-3.0-only license_treatment: copyleft maintenance: active --- # typedload — Load and dump data from json-like format into typed data structures License: copyleft · Maintenance: active · Popularity: top 1,000 on PyPI ## Install pip install typedload uv add typedload poetry add typedload ## Description typedload ========= Load and dump json-like data into typed data structures in Python3, enforcing a schema on the data. This module provides an API to load dictionaries and lists (usually loaded from json) into Python's NamedTuples, dataclass, sets, enums, and various other typed data structures; respecting all the type-hints and performing type checks or casts when needed. It can also dump from typed data structures to json-like dictionaries and lists. It is very useful for projects that use Mypy and deal with untyped data like json, because it guarantees that the data will follow the specified schema. It is released with a GPLv3 license but [it is possible to ask for LGPLv3](mailto:tiposchi@tiscali.it). ![GPLv3 logo](docs/gpl3logo.png) [![Donate to LtWorf](docs/donate.svg)](https://liberapay.com/ltworf/donate) Example ======= For example this dictionary, loaded from a json: ```python data = { 'users': [ { 'username': 'salvo', 'shell': 'bash', 'sessions': ['pts/4', 'tty7', 'pts/6'] }, { 'username': 'lop' } ], } ``` Can be treated more easily if loaded into this... ## AI interpretation — verify before relying Loads and dumps JSON-like data into typed Python structures (dataclasses, NamedTuples, enums, etc.), enforcing schema validation at runtime while respecting type hints. Verdict: Production-ready library (stable since 2018) with zero dependencies, active maintenance, and no known vulnerabilities. GPLv3 copyleft license requires verification of compatibility with your project. Ideal for projects using mypy that need runtime schema validation on untyped JSON data. [View on SkillFed](https://skillfed.io/packages/typedload) · [View on PyPI](https://pypi.org/project/typedload/)