You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using Xero-python 1.8 on python 3.10.4 trying to convert a Journal to dictionary using to_dict method.
I expect to have a json serializable dict of primitive values however I get an AccountType enum which is not serializable.
simple enough to have a custom encoder that handles enums but it would also be rather simple to extend the serializer process here to enable proper conversion.
adding following code to models.py fixes the issue:
Enum issue was solved for me by upgrading to xero-python==1.16.0 however note that this introduced different errors for UUID and None
fromxero_python.api_client.serializerimportserialize_model@serialize_model.register(UUID)defserialize_uuid_model(model):
"""Serializes api model into an json serializable object. :param model: BaseModel instance to serialize :return: serialized object """returnmodel.hex
using Xero-python 1.8 on python 3.10.4 trying to convert a Journal to dictionary using
to_dict
method.I expect to have a json serializable dict of primitive values however I get an AccountType enum which is not serializable.
simple enough to have a custom encoder that handles enums but it would also be rather simple to extend the serializer process here to enable proper conversion.
adding following code to
models.py
fixes the issue:please let me know if a pr is welcome for this or if further information is required.
The text was updated successfully, but these errors were encountered: