以下是字符串。帮助得到这个。
谢谢你前进!!
{
"status" : 0,
"message" : payment status for :111189,
"result" : -{
"postBackParamId" : 1321,
"mihpayid" : 4039937155186,
"paymentId" : 11117,
"mode" : CC,
"status" : failure,
"unmappedstatus" : failed
}
}
答案 0 :(得分:2)
JSONObject jsonObject = new JSONObject( JSON_response );
int status = jsonObject.getInt("status");
String message = jsonObject.getString("message");
String result = jsonObject.getString("result");
JSONObject jsonObject1 = new JSONObject( result );
int postBackParamId = jsonObject1.getInt("postBackParamId");
String mihpayid = jsonObject1.getString("mihpayid");
int paymentId = jsonObject1.getInt("paymentId");
String mode = jsonObject1.getString("mode");
String result_status = jsonObject1.getString("status");
String unmappedstatus = jsonObject1.getString("unmappedstatus");
答案 1 :(得分:0)
public class ApiResponse {
public Integer status;
public String message;
public Result result;
}
public class Result {
public Integer postBackParamId;
public String mihpayid;
public Integer paymentId;
public String mode;
public String status;
public String unmappedstatus;
}
使用诸如Retrofit之类的任何库访问Web服务时传递ApiResponse类,然后成功获取如下值:-
response.result.postBackParamId (response object in on success).