标签:
关于JSON.parseObject使用记录
1.新建bean
NewBean:
public class NewBean{
private String name;
private String age;
public void setName(String name){
this.name = name;
}
public String getName(){
return name;
}
public void setAge(String age){
this.age = age;
}
public String getAge(){
return age;
}
}
2.json解析并给bean赋值
NewBean result = JSON.parseObject(jsonMsg.getData(), NewBean.class);
3.从bean中获取子值
NewBean newbean;
String user_name = newbean.getName();
String user_age = newbean.getAge();
标签:
原文地址:http://www.cnblogs.com/ponos/p/4317824.html