对象:
import android.R.bool;
public class WebServerData { /// <summary> /// 返回数据 /// </summary> public String data;
/// <summary> /// 提示消息 /// </summary>
public String msg ;
/// <summary> /// 是否成功 /// </summary>
public bool success ;
public String getData() { return data; }
public void setData(String data) { this.data = data; }
public String getMsg() { return msg; }
public void setMsg(String msg) { this.msg = msg; }
public bool getSuccess() { return success; }
public void setSuccess(bool success) { this.success = success; } }
转换:
String d = msg.getData().getString("data"); Gson gson = new Gson();
gson.fromJson(d, WebServerData.class);
问题:问什么把对象中bool类型的参数去掉转换成功,有bool类型的就失败?