{"body" : {"mobile":"13714664734","email":"","icon":"","open_id":"f5994ced6530405ebc07f8fecd1beb12","country_code":"86","user_name":"13714664734","is_update_name":"0"},
"code":"0","msg":"成功"}
{}:是对象--->sonObject = new JSONObject(response);jsonBody = jsonObject.optJSONObject("body");String mobile= jsonBody .optString("mobile");{ "body": { "PRoducts": [ { "describe": "无流量限制", "type": 1, //产品类型(0:虚拟 1:实际) " }], "coupons": [ { "name": "折扣券", //优惠券名称 "describe": "", //优惠券描述 }], "amount": 12.11, //订单总金额 "order_num": "12000100", //订单流水号 }, "code": "0", "msg": "成功"}
[]:是集合 :
JSONArray jsonArrayProList = jsonBody.optJSONArray("products");
jsonArrayProList 是集合,定义循环,解析多个products.
JSONObject jsonObjectOne = jsonArrayProList.optJSONObject(i);String describe = jsonObjectOne.optString("describe");
新闻热点
疑难解答