Skip to content

Instantly share code, notes, and snippets.

@kayz1
Created August 16, 2013 07:36
Show Gist options
  • Save kayz1/6248004 to your computer and use it in GitHub Desktop.
Save kayz1/6248004 to your computer and use it in GitHub Desktop.
List<String> listOfStrings = new ArrayList<String>();
listOfStrings.add("one");
listOfStrings.add("two");
Gson gson = new Gson();
String json = gson.toJson(listOfStrings);
System.out.println(json);
Type type = new TypeToken<Collection<String>>(){}.getType();
List<String> fromJson = gson.fromJson(json, type);
System.out.println(fromJson);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment