Currently I try to convert data from an ESRI shapefile (.shp) to a Json file using the json package.
In this process, I want to convert a dictionairy containing the coordinates of a lot of different points:
json.dumps({"Points" : coordinates})
The list "coordinates" looks like:
[[-2244.677490234375, -3717.6876220703125], [-2252.7623006509266, -3717.321774721159],
..., [-2244.677490234375, -3717.6876220703125]]
and contains about several hundreds of coordinate pairs.
However, when I try to execute json.dumps, I get the following error:
[-2244.677490234375, -3717.6876220703125] is not JSON serializable
My first thought was, that it can not handle decimal/float values But if I execute the following working example containing only two of the coordinate pairs:
print(json.dumps({"Points" : [[-2244.677490234375, -3717.6876220703125],
[-2244.677490234375, -3717.6876220703125]]}))
tt works and I do not get an error... The output in this case is:
{"Points": [[-2244.677490234375, -3717.6876220703125], [-2244.677490234375, -3717.6876220703125]]}
I don't get why it isn't working with my "coordinates"-list.