Open sbland opened 3 years ago
I also encountered this error.
FeatureCollection
class inherits dict
class and asdict
method tries to deep-copy the FeatureCollection object to another FeatureCollection object (here). But, constructor of FeatureCollection
class takes features as a first argument.
You can see the same error when running the following code.
from geojson import FeatureCollection
print(FeatureCollection((k, v) for k, v in FeatureCollection(features=[]).items()))
Dict class works for almost same code.
print(dict((k, v) for k, v in dict(features=[]).items()))
I think FeatureCollection class should behave in the same way as dict in order to be used as a attribute of dataclass.
I'm trying to store an instance of a feature collection inside a dataclass but when using the asdict function to parse the dataclass it fails with
TypeError: Object of type generator is not JSON serializable
Python Version 3.8.6
Test case:
Stack trace: