http://www.cnblogs.com/jiayongji/p/5297187.html(gson把返回的string数据,转化为实体类)
Json转换利器Gson之实例一-简单对象转化和带泛型的List转化
http://blog.csdn.net/lk_blog/article/details/7685169
package cardvalue.managementsystem.pojo;
import com.google.gson.Gson;
/**
* Created by Administrator on 2017/7/7.
*/
public class Result<T> {
public String type;
public String result;
public int code;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getResult() {
return result;
}
public void setResult(String result) {
this.result = result;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public T parseJsonWithGson(String result, Class type) {
Gson gson = new Gson();
T result1 = (T)gson.fromJson(result, type);
return result1;
}
}
gson
最新推荐文章于 2023-11-28 19:56:54 发布