jsonalias
A microlibrary that defines a Json type alias for Python.
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 jsonaliasuv
uv add jsonaliaspoetry
poetry add jsonaliasInstalling 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
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
typing-jsonProvides type-aware JSON serialization and…
permissive · top 15,000 on PyPI
json-strong-typingSerializes Python dataclasses to JSON and…
permissive · top 15,000 on PyPI
flatdictFlattens nested dictionaries into single-level…
permissive · top 5,000 on PyPI
jsonschema-typed-v2Generates Python TypedDict type annotations…
permissive · top 15,000 on PyPI
jsoncompatChecks whether evolving JSON Schemas remain…
unclear · top 15,000 on PyPI
jsonlinesSimplifies reading and writing jsonlines…
permissive · top 5,000 on PyPI
databindDatabind deserializes JSON-like nested data…
permissive · top 15,000 on PyPI
condense-jsonCondense JSON by replacing repeated strings and…
permissive · top 15,000 on PyPI
json-normalizeRecursively flattens nested JSON-like…
permissive · top 15,000 on PyPI
pampyPampy provides pattern matching for Python,…
permissive · top 15,000 on PyPI