53 lines
993 B
Java
53 lines
993 B
Java
import com.google.gson.Gson;
|
|
|
|
class RegisterData
|
|
{
|
|
private String email;
|
|
private String nickname;
|
|
private String pwass;
|
|
private String school;
|
|
|
|
public String getEmail()
|
|
{
|
|
return email;
|
|
}
|
|
public void setEmail(String Email)
|
|
{
|
|
email=Email;
|
|
}
|
|
public String getNickname()
|
|
{
|
|
return nickname;
|
|
}
|
|
public void setNickname(String Nickname)
|
|
{
|
|
nickname=Nickname;
|
|
}
|
|
public String getPass()
|
|
{
|
|
return pwass;
|
|
}
|
|
public void setPass(String Pwass)
|
|
{
|
|
pwass=Pwass;
|
|
}
|
|
public String getSchool()
|
|
{
|
|
return school;
|
|
}
|
|
public void setSchool(String School)
|
|
{
|
|
school=School;
|
|
}
|
|
}
|
|
|
|
public class JsonStudy
|
|
{
|
|
public static void main(String[] args)
|
|
{
|
|
String jsonData="{'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());
|
|
}
|
|
} |