Skip to content

Instantly share code, notes, and snippets.

@hongruiqi
Created December 24, 2012 07:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hongruiqi/4368212 to your computer and use it in GitHub Desktop.
Save hongruiqi/4368212 to your computer and use it in GitHub Desktop.
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