I am trying to encode JSON with json.JSONEncoder
with another pattern by overriding the default
method:
class X(json.JSONEncoder):
def default(self, obj):
return ["ok"]
json.dumps(self, cls=X)
But the default method is not being called... I saw a few examples who looks like this, but I can't figure out what is missing?
currently, I get my json as {"status": "Fail"}
Note: followed this link.
I am using python 3.6 Thank you