hug
hug copied to clipboard
Document how to extend json serialization
Not sure where to add this in the documentation, but if you get an error such as this when trying to output
TypeError: Type <class 'uuid.UUID'> not serializable
You can add new types to the json converter like this
from uuid import UUID
@hug.output_format.json_convert(UUID)
def uuid_stringable(item):
return str(item)