Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

TypeError: Object of type DictProxy is not JSON serializable

import multiprocessing, json
class JSONEncoderWithDictProxy(json.JSONEncoder):
	    def default(self, o):
             if isinstance(o, multiprocessing.managers.DictProxy):
                     return dict(o)
             return json.JSONEncoder.default(self, o)

json.dumps(your_nested_d, cls=JSONEncoderWithDictProxy)
 
PREVIOUS NEXT
Tagged: #Object #type #DictProxy #JSON #serializable
ADD COMMENT
Topic
Name
4+5 =