Created
August 16, 2013 07:36
-
-
Save kayz1/6248004 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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