sqlalchemy-mixins icon indicating copy to clipboard operation
sqlalchemy-mixins copied to clipboard

Feature request: SerializeMixin - Add `to_json()` with support for custom JSON encoding

Open lararosekelley opened this issue 4 years ago • 1 comments

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.

lararosekelley avatar Sep 19 '20 12:09 lararosekelley

@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

PrasanthChettri avatar Apr 01 '21 10:04 PrasanthChettri