Registry / serialization / jsonalias

jsonalias

JSON →
library0.1.2pypypi✓ verified 35d ago

Jsonalias is a microlibrary (current version 0.1.2) that defines a `Json` type alias for Python. It provides a convenient way to type-hint JSON-like structures, which are typically composed of nested dictionaries, lists, strings, numbers, booleans, and None. Given its singular purpose, the release cadence is expected to be slow, with updates primarily for compatibility or if the alias is integrated into Python's standard `typing` module.

serialization
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

from jsonalias import Json

The `Json` type alias can be used to annotate variables, function parameters, and return types that are expected to conform to a JSON-like structure. It supports nested dictionaries, lists, and primitive JSON types.

from jsonalias import Json # Example of type-hinting a complex JSON structure def process_json_data(data: Json): print(f"Processing data: {data}") if isinstance(data, dict): print(f"Keys: {list(data.keys())}") elif isinstance(data, list): print(f"Length: {len(data)}") # A valid JSON structure adhering to the alias data_example: Json = { "name": "Alice", "age": 30, "isStudent": False, "courses": ["Math", "Science"], "address": {"street": "123 Main St", "zip": "90210"}, "metadata": None } process_json_data(data_example) # Another example, a list of JSON objects list_example: Json = [ {"id": 1, "value": "A"}, {"id": 2, "value": "B"} ] process_json_data(list_example)
Debug
Known footguns
gotchaThe library's `Json` alias explicitly mirrors Python's native JSON representation, including `None` for null. Ensure your data conversion matches this if coming from other languages.
gotchaThe author notes that this alias might eventually be added to Python's standard `typing` module. If `Json` is officially adopted there, the `jsonalias` library might become redundant or could lead to naming conflicts if not carefully managed.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
0 hits · last 30 days

No traffic data recorded yet.

Resources