作者:铁合金在线 | 来源:互联网 | 2023-10-12 11:22
java解析JSON字符串的方法:StringjsonStr[{product_id:7AE370D2-E212-49DC-85DF-EB900E02F0AB,is_anony
java解析JSON字符串的方法:
String jsOnStr=
"[{"product_id":"7AE370D2-E212-49DC-85DF-EB900E02F0AB","is_anonymous":"0"},{"product_id":"A8720D7F-5FD0-4D9E-A30E-3918264C6772","is_anonymous":"0"}]"
JSONArray jsonArray;
try {
jsOnArray=
new JSONArray(productStr);
int iSize =
jsonArray.length();
for(int i = 0; i
JSONObject jsOnObj= jsonArray.getJSONObject(i);
String product_id =
jsonObj.get("product_id").toString();
String is_anonymous =
jsonObj.get("is_anonymous").toString();
}
} catch (JSONException e)
{
// TODO Auto-generated catch
block
e.printStackTrace();
}