Apr-05-2022, 06:26 PM
I try two method describe in that document but didn't work that is why ask. searching around didn't find any example either.
here is what I try
# Option 1: supply json_stream.encoding.default as the default argument
print(json.dumps(data, default=default))
# Option 2: supply json_stream.encoding.JSONStreamEncoder as the cls argument
# This allows you to created your own subclass to further customise encoding
print(json.dumps(data, cls=JSONStreamEncoder))
both prints empty dictionary.
here is what I try
# Option 1: supply json_stream.encoding.default as the default argument
print(json.dumps(data, default=default))
# Option 2: supply json_stream.encoding.JSONStreamEncoder as the cls argument
# This allows you to created your own subclass to further customise encoding
print(json.dumps(data, cls=JSONStreamEncoder))
both prints empty dictionary.