skillfed

jsonalias

A microlibrary that defines a Json type alias for Python.

jsonalias v0.1.2 1.4M downloads/30d#3,981 on PyPI20
Permissive license MIT DORMANT released

What it is and what it does

jsonalias exports a single recursive type alias, `Json`, that represents any valid JSON value: a dictionary with string keys and JSON values, a list of JSON values, or a primitive (string, integer, float, boolean, or None). The alias is defined using Python's `typing` module and supports recursive self-reference, allowing you to annotate variables and function parameters that hold JSON-compatible data.

The package exists because this type alias is useful across multiple projects but verbose enough to be tedious to redefine. It requires mypy >= 0.981 with the --enable-recursive-aliases flag to type-check correctly. The implementation is minimal—just a few lines of type definition—and carries no runtime dependencies, making it a zero-cost addition to your type-checking workflow.

Use it for:

  • Annotate function parameters that accept arbitrary JSON data from APIs or file parsing
  • Type-hint configuration dictionaries or settings objects with mixed nested structures
  • Define return types for JSON serialization or deserialization functions
  • Validate type consistency in data transformation pipelines that work with JSON
  • Document expected shapes for dynamically-structured data in codebases using strict typing

Worth the install?

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

Provides a recursive type alias for JSON-compatible data structures in Python, enabling type hints for dictionaries, lists, and primitive values.

Yes, if you use type hints and work with JSON data. The package is stable, has no dependencies, and solves a genuine typing problem. Dormant maintenance is not a concern for a minimal, self-contained type alias. Verify mypy version and configuration requirements before adopting in strict type-checking environments.

Install

jsonalias on PyPI

pip

pip install jsonalias

uv

uv add jsonalias

poetry

poetry add jsonalias

Installing jsonalias

Before you install

Low friction: pure Python, no runtime dependencies, distributed as a wheel. Dormant maintenance (last release October 2022, last commit January 2025) but the package is minimal and stable—no active development needed.

License in practice

MIT license permits unrestricted use, modification, and distribution in commercial and private projects with minimal attribution requirements.

Quickstart

from jsonalias import Json

d: Json = {"foo": ["bar", {"x": "y"}]}

Requires mypy >= 0.981 with --enable-recursive-aliases flag for type checking to work correctly.

Verify before relying

  • Whether mypy >= 0.981 with --enable-recursive-aliases is a hard requirement or merely recommended for full type-checking support
  • Compatibility with type checkers other than mypy (e.g., pyright, pyre)

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.7,<4.0)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance dormant — 1,384 days since the last release
Last repo commit
First released
Downloads 1,380,947/month — #3,981 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: jsonalias-0.1.2-py3-none-any.whl

License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

json type alias pythontyping json recursivejson type hintpython json typingrecursive type alias json
typingjson-schema

More Software Development packages