websockets.py send_json() doesnt' allow custom encoder #2115
Answered
by
Kludex
amalizzio
asked this question in
Potential Issue
-
I recently switched from django to fastapi and django allows in most places to pass custom encoder . I have datetimes in objects and nan's which need special treatment. My workaround is json.dumps(json.loads(deep_dictionary,cls=MyEncoder)) which is not efficient. Should you pass through in send_json a custom encoder to the json.dumps please? Thank you, Anthony |
Beta Was this translation helpful? Give feedback.
Answered by
Kludex
Jan 14, 2024
Replies: 1 comment
-
For the time being, the way to do it is to implement the logic of |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Kludex
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For the time being, the way to do it is to implement the logic of
send_json
yourself i.e. callWebSocket.send()
.