syside.JsonReader

class JsonReader

Unbound reader for JSON deserialization

Initialization

bind(s: str) → syside.JsonReader

Bind a serialized JSON string for reading.

Note that only one reader can be bound at a time, binding again will raise ValueError. Suggested usage is through a context manager:

with reader.bind(json_str) as json:
    model, report = deserializer.accept(json, syside.DESERIALIZE_STANDARD)
property is_bound: bool

Whether there currently is a reader bound to this resource.

class StrReader

Bases: syside.Reader

Bound reader for JSON deserialization that can be used together with Deserializer.

Resource usage can be controlled through context manager.

unbind() → None

Unbind this reader explicitly, allowing resources to be reused for other reads.

Attempting to use this for deserialization again will raise RuntimeError.

attribute_hint() → syside.AttributeMap | None

Get a hint for deserialization attributes.

__enter__() → syside.JsonReader
__exit__(exc_type: type[BaseException] | None, exc: BaseException | None, traceback: types.TracebackType | None) → None