import com.google.gson.Gson; class AppJsonData { private String type; public String getType() { return type; } public void setType(String Type) { type=Type; } } class LoginData extends AppJsonData { private String email; private String pwass; public String getEmail() { return email; } public void setEmail(String Email) { email=Email; } public String getPass() { return pwass; } public void setPass(String Pwass) { pwass=Pwass; } } class RegisterData extends LoginData { private String nickname; private String school; public String getNickname() { return nickname; } public void setNickname(String Nickname) { nickname=Nickname; } public String getSchool() { return school; } public void setSchool(String School) { school=School; } } class UploadData extends AppJsonData { private String bookname; private String author; private String context; private String imageURL; public String getBookname() { return bookname; } public void setBookname(String Bookname) { bookname=Bookname; } public String getAuthor() { return author; } public void setAuthor(String Author) { author=Author; } public String getContext() { return context; } public void setContext(String Context) { context=Context; } public String getImageURL() { return imageURL; } public void setImageURL(String ImageURL) { imageURL=ImageURL; } } class FetchData extends UploadData { private String label; public String getLabel() { return label; } public void setLabel(String Label) { label=Label; } } /* public class JsonStudy { public static void main(String[] args) { String jsonData="{'type':'register','email':'test@163.com','nickname':'Kirito','school':'QUST','pwass':'dvaLovesU'}"; Gson gson=new Gson(); RegisterData data=gson.fromJson(jsonData, RegisterData.class); System.out.println("Email:"+data.getEmail()+" NickName:"+data.getNickname()+" School:"+data.getSchool()+" Password:"+data.getPass()); } } */