sqlalchemy-mixins
sqlalchemy-mixins copied to clipboard
Feature request: SerializeMixin - Add `to_json()` with support for custom JSON encoding
Types like UUID or custom types from libraries like sqlalchemy-utils cannot be serialized to JSON by default from a Python dict, making monkey-patching the default JSONEncoder or providing a custom encoder class common practice. It would be nice to add a to_json() method to the SerializeMixin alongside the provided to_dict() method, with the ability to pass in an encoder param to the function to serialize a model to JSON.
@michaelbukachi I would like to work on this issue, the thing is idk how to do this, if anyone can give me a broad overview of how to implement something like this, that would be nice