skillfed

json-strong-typing

Type-safe data interchange for Python data classes

json-strong-typing v0.4.3 133.4K downloads/30d#11,517 on PyPI9
Permissive license MIT AGING released

What it is and what it does

json-strong-typing bridges the gap between Python's type system and JSON interchange by providing bidirectional conversion between typed dataclasses and JSON. It handles complex types—UUIDs, decimals, datetimes, nested dataclasses, generics—without requiring you to inherit from a custom base class or modify your class definitions. The package also generates JSON schemas from Python types, which is useful for API documentation and validation.

The core use case is working with strongly-typed Python objects in contexts where JSON is the wire format: cloud functions receiving HTTP payloads, API endpoints validating input, configuration file parsing, or OpenAPI specification generation. It operates on plain dataclasses and named tuples without imposing a framework dependency, making it suitable for third-party classes you don't control.

Use it for:

  • Serialize dataclass instances to JSON for HTTP APIs or message queues, then deserialize responses back to typed objects.
  • Generate JSON schemas from dataclass definitions for OpenAPI specifications or JSON schema validation.
  • Parse JSON configuration files into strongly-typed Python objects with automatic type coercion.
  • Validate incoming JSON payloads against Python dataclass types in cloud functions or web handlers.
  • Convert between Python objects and JSON in microservices that communicate via JSON messages.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Serializes Python dataclasses to JSON and deserializes JSON back to typed objects, with support for complex types like UUIDs, decimals, and nested structures, plus JSON schema generation for validation and OpenAPI specs.

Yes, if you work with dataclasses and JSON interchange. The package is stable (Production/Stable classifier), has no known vulnerabilities, and low install friction. The aging maintenance status (197 days since last release) is a minor concern but not disqualifying—the repository is active and the library is relatively mature. Install it if you need type-safe JSON serialization without framework lock-in.

Install

json-strong-typing on PyPI

pip

pip install json-strong-typing

uv

uv add json-strong-typing

poetry

poetry add json-strong-typing

Installing json-strong-typing

Before you install

Low friction: pure Python wheel with only two lightweight runtime dependencies (jsonschema and typing_extensions). Maintenance status is aging—last release was 197 days ago—but the repository remains active and unarchived.

License in practice

MIT license permits use in commercial and proprietary projects with minimal restrictions; attribution required.

Quickstart

from dataclasses import dataclass
from json_strong_typing.serialization import object_to_json, json_to_object

@dataclass
class Example:
    name: str
    value: int

obj = Example(name="test", value=1)
json_obj = object_to_json(obj)
restored = json_to_object(Example, json_obj)

Requires Python 3.9 or later; dataclasses must use type annotations.

Verify before relying

  • Whether custom serialization/deserialization hooks are well-documented and easy to implement for non-standard types.
  • Performance characteristics when handling large or deeply nested dataclass hierarchies.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies 2 — jsonschema, typing_extensions
Maintenance aging — 197 days since the last release
Last repo commit
First released
Downloads 133,360/month — #11,517 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: json_strong_typing-0.4.3-py3-none-any.whl

Keywords: json-schema, json-parsing, json-serialization, docstring-documentation, type-inspection

Development Status :: 5 - Production/StableIntended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Topic :: File Formats :: JSONTopic :: File Formats :: JSON :: JSON SchemaTopic :: Text Processing :: Markup :: reStructuredTextTyping :: Typed

Tags

dataclass json serializationtype-safe json parsingjson schema generationpython dataclass to jsonstrongly typed json interchangejson validation with typesdataclass json deserialization
json-serializationtype-safetydataclass-tools

More JSON packages