Skip to content

bagof.hints.json

Types related to JSON (de)serialization.

Attributes

JSONNumber module-attribute

JSONNumber = Union[int, float]

A number that is properly handled by json.dump: (int | float).

JSONScalar module-attribute

JSONScalar = Union[int, float, bool, str, None]

A scalar that is properly handled by json.dump: (int | float | bool | str | None).

JSON module-attribute

JSON = Union[JSONScalar, Dict[str, 'JSON'], BuiltinSequence['JSON']]

A value that is properly handled by json.dump: JSON = JSONScalar | Dict[str, JSON] | List[JSON] | Tuple[JSON, ...]. Note that this is a recursive type.

JSONDict module-attribute

JSONDict = Dict[str, JSON]

A JSON dictionary.

MutableJSON module-attribute

MutableJSON = Union[JSONScalar, Dict[str, 'MutableJSON'], List['MutableJSON']]

A JSON value, where all structures (arrays and objects) are mutable.

MutableJSONDict module-attribute

MutableJSONDict = Dict[str, MutableJSON]

A mutable JSON dictionary.