Skip to content

jetblack_serialization

module jetblack_serialization.json

Summary

JSON Serialization

function jetblack_serialization.json.deserialize

Summary

Convert JSON to an object

jetblack_serialization.json.deserialize(
text: str,
annotation: Annotation,
config: SerializerConfig
) -> Any

Parameters

text: str

The JSON string

annotation: Annotation

The type annotation

config: SerializerConfig

The serializer configuration

Returns

Any: The deserialized object.

function jetblack_serialization.json.from_json_value

Summary

Convert from a json value

jetblack_serialization.json.from_json_value(
config: SerializerConfig,
json_value: Any,
annotation: Annotation
) -> Any

Parameters

config: SerializerConfig

The serialier configuration

json_value: Any

The JSON value

annotation: Annotation

The type annotation

Returns

Any: The deserialized value

function jetblack_serialization.json.serialize

Summary

Convert the object to JSON

jetblack_serialization.json.serialize(
obj: Any,
annotation: Annotation,
config: SerializerConfig
) -> str

Parameters

obj: Any

The object to convert

annotation: Annotation

The type annotation

config: SerializerConfig

The serializer configuration

Returns

str: The serialized object

class JSONProperty(JSONAnnotation)

Summary

A JSON property

jetblack_serialization.json.JSONProperty(
tag: str
) -> None

Parameters

tag: str


class JSONValue(JSONAnnotation)

Summary

A JSON property

jetblack_serialization.json.JSONValue() -> None