How to write a custom JSON decoder for a complex object?
The encoder/decoder example you reference (here) could be easily extended to allow different types of objects in the JSON input/output. However, if you just want a simple decoder to match your encoder (only having Edge objects encoded in your JSON file), use this decoder: class EdgeDecoder(json.JSONDecoder): def __init__(self, *args, **kwargs): json.JSONDecoder.__init__(self, object_hook=self.object_hook, *args, **kwargs) def … Read more