Initial JSON Type Support in Python
Date: 5/21/2022 · Tags: #python, #tilBecause typing system in Python lacks of recursive type, we can not annotate
JSON-like data for type hints. Recently, There is a progress that an
experimental JSON
type has been implemented under _typeshed
lib.
Try it like:
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from _typeshed import JSON
Of course, we still need to wait offical JSON
type support.
Update 2022-06-22: The PR in typeshed
still can not be merged.