How to change default response.json

I want to modify response.json to a custom method
but I don’t want to modify the source code

for example:

class Json(json.JSONEncoder):
    def default(self, o):
        if isinstance(o, ObjectId):
            return str(o)
        return super().default(o)

Here is how to replace the json method:

1 Like

I looked for a lot of documentation on configuration, but I forgot to look here.

1 Like