JsonParser

class xsdata.formats.dataclass.parsers.JsonParser(context=<factory>)[source]

Json parser for dataclasses.

Parameters

context (XmlContext) – Model context provider

from_path(path, clazz=None)[source]

Parse the input file path and return the resulting object tree.

Parameters
Return type

~T

parse(source, clazz=None)[source]

Parse the JSON input stream and return the resulting object tree.

Parameters
Return type

~T

bind_value(var, value)[source]

Bind value according to the class var.

Parameters
Return type

Any

bind_dataclass(data, clazz)[source]

Recursively build the given model from the input dict data.

Parameters
Return type

~T

maybe_bind_dataclass(data, clazz)[source]

Recursively build the given model from the input dict data but fail on any converter warnings.

Parameters
Return type

Optional[~T]

bind_dataclass_union(value, var)[source]

Bind data to all possible models and return the best candidate.

Parameters
Return type

Any

bind_wildcard(value)[source]

Bind data to a wildcard model.

Parameters

value (Any) –

Return type

Any

bind_choice(value, var)[source]

Bind data to one of the choice models.

Parameters
Return type

Any

bind_choice_simple(value, var)[source]

Bind data to one of the simple choice types and return the first that succeeds.

Parameters
Return type

Any

bind_choice_generic(value, var)[source]

Bind data to a either a derived or a user derived model.

Parameters
Return type

Any

bind_choice_dataclass(value, var)[source]

Bind data to the best matching choice model.

Parameters
Return type

Any

classmethod parse_value(value, types, default, tokens, fmt)[source]

Convert any value to one of the given var types.

Parameters
Return type

Any