Save custom object in slot [ User Defined Class ]

What is the recommended approach to save custom objects ( user defined class ) to slots. Currently when I try to set the slot in the return on the action class, sanic complains that it is not json serializable.

Any suggestions are appreciated.