{"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");
|
新聞熱點
疑難解答