gson
来源:互联网 发布:阿里云发短信 php代码 编辑:程序博客网 时间:2024/05/17 00:59
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; }}