Created
December 24, 2012 07:27
-
-
Save hongruiqi/4368212 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
package bus; | |
import com.google.gson.Gson; | |
public class Json { | |
private static class Announce { | |
private String Caption; | |
private String Text; | |
private long CreatedAt; | |
} | |
private static class Version { | |
private String Version; | |
private String Desc; | |
private String Url; | |
private long Time; | |
} | |
private static class Update { | |
private Announce Announce; | |
private Version Version; | |
} | |
public static void main(String argv[]) { | |
Update update = new Update(); | |
Gson gson = new Gson(); | |
update = gson.fromJson("{\"Announce\":{\"Caption\":\"@杰克华君\",\"Text\":\"@杰克华君,感谢你为百步梯做出的一切,我们不会忘记,我们会继续加油的。RIP\",\"CreatedAt\":1356318536},\"Version\":{\"Version\":\"1.0\",\"Desc\":\"囧囧囧囧囧囧\",\"Url\":\"http://www.100steps.net\",\"Time\":1356074980}}", update.getClass()); | |
System.out.println(update.Announce.Caption); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment