Continuing from this question.
I\'m having trouble deserializing the following json array (Sorry for the size):
\"geometry\": { \"type\": \"Polygon\"
The coordinates in JSON is a three-dimensional matrix. With Collection you're going one dimension too far. The Collection itself is already one dimension, so you've basically declared a four-dimensional matrix.
With the error message, Gson is basically telling you that it is expecting an object for the fourth dimension, but it instead encountered a double.
The following represent valid three-dimensional matrices which should be perfectly handled by Gson:
private double[][][] coordinates; (recommended)private Collection[] coordinates; private Collection coordinates; private Collection> coordinates; private Collection>> coordinates; That said, I would prefer List above Collection in this particular case. With a List you can guarantee that it's been filled with insertion order and you'll be able to get elements by index.