class documentation

class JSONTypeConverter(ABC): (source)

View In Hierarchy

Converter for converting an object from Python json.loads result (e.g. scalar, list, or dict) to a known type.

Method to_typed_value Convert the given value to a type based on the given hint.
Class Variable Unhandled Sentinel value that must be used as the result of to_typed_value to say the given type is not handled by this converter.
@abstractmethod
def to_typed_value(self, hint: type, value: Any) -> Any | None | _JSONTypeConverterUnhandled: (source)

Convert the given value to a type based on the given hint.

Parameters
hint:typeType hint to use to help in converting the value.
value:AnyValue as returned by json.loads. Usually a scalar, list, or dict.
Returns
Any | None | _JSONTypeConverterUnhandledThe converted value or Unhandled if this converter does not handle this situation.
Unhandled = (source)

Sentinel value that must be used as the result of to_typed_value to say the given type is not handled by this converter.