JsonSerializer¶ class xsdata.formats.dataclass.serializers.JsonSerializer(context=<factory>, encoder=None, dict_factory=<class 'dict'>, indent=None)[source]¶ Json serializer for dataclasses. Parameters context (XmlContext) – Model context provider encoder (Optional[Type[JSONEncoder]]) – JSONEncoder type indent (Optional[int]) – Output indentation dict_factory (Callable) – Override default dict factory to add further logic. dict_factory¶ alias of dict render(obj)[source]¶ Convert the given object tree to json string. Parameters obj (object) – Return type str write(out, obj)[source]¶ Write the given object tree to the output text stream. Parameters out (TextIO) – The output stream obj (Any) – The input dataclass instance