Skip to content

Instantly share code, notes, and snippets.

@bazo
Last active December 15, 2015 08:48
Show Gist options
  • Save bazo/5233194 to your computer and use it in GitHub Desktop.
Save bazo/5233194 to your computer and use it in GitHub Desktop.
json to array conversion
GsonBuilder gsonBuilder = new GsonBuilder();
Gson inputGson = new Gson();
ArrayList<ArrayList<String>> list = inputGson.fromJson(json, ArrayList.class);
Coordinate[] coordinates = new Coordinate[list.size()];
for (int i = 0; i < list.size(); i++) {
coordinates[i] = new Coordinate(Double.parseDouble(list.get(i).get(0)), Double.parseDouble(list.get(i).get(1)));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment