# JsonParser

class xsdata.formats.dataclass.parsers.JsonParser(config=<factory>, context=<factory>, load_factory=<function load>)

  Json parser for dataclasses.

  Parameters

    - config (`ParserConfig`) – Parser configuration

    - context (`XmlContext`) – Model context provider

    - load_factory (`Callable`) – Replace the default json.load call with another implementation

  load_factory(*, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw)

    Deserialize `fp` (a `.read()`-supporting file-like object containing a JSON document) to a Python object.

    `object_hook` is an optional function that will be called with the result of any object literal decode (a `dict`). The return value of `object_hook` will be used instead of the `dict`. This feature can be used to implement custom decoders (e.g. JSON-RPC class hinting).

    `object_pairs_hook` is an optional function that will be called with the result of any object literal decoded with an ordered list of pairs. The return value of `object_pairs_hook` will be used instead of the `dict`. This feature can be used to implement custom decoders. If `object_hook` is also defined, the `object_pairs_hook` takes priority.

    To use a custom `JSONDecoder` subclass, specify it with the `cls` kwarg; otherwise `JSONDecoder` is used.

  parse(source, clazz=None)

    Parse the input stream or filename and return the resulting object tree.

    Return type

      ~T

  bind_dataclass(data, clazz)

    Recursively build the given model from the input dict data.

    Return type

      ~T

  bind_best_dataclass(data, classes)

    Attempt to bind the given data to one possible models, if more than one is successful return the object with the highest score.

    Return type

      ~T

  bind_optional_dataclass(data, clazz)

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

    Return type

      `Optional`[~T, `None`]

  bind_value(meta, var, value, recursive=False)

    Main entry point for binding values.

    Return type

      `Any`

  bind_text(meta, var, value)

    Bind text/tokens value entrypoint.

    Return type

      `Any`

  bind_complex_type(meta, var, data)

    Bind data to a user defined dataclass.

    Return type

      `Any`

  bind_derived_value(meta, var, data)

    Bind derived element entry point.

    Return type

      ~T

  __eq__(other)

    Return self==value.

  __hash__ = None
  from_bytes(source, clazz=None)

    Parse the input bytes array return the resulting object tree.

    Return type

      ~T

  from_path(path, clazz=None)

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

    Return type

      ~T

  from_string(source, clazz=None)

    Parse the input string and return the resulting object tree.

    Return type

      ~T