我对 jsonObject 有疑问。
在android应用程序中,我有:
try {
jObj = new JSONObject(json);
} catch (JSONException e) {
Log.e("JSON Parser", "Error parsing data " + e.toString());
Log.e("JSON Parser2", "json: "+json);
}
日志猫是:
01-03 16:50:09.239: E/JSON Parser(17447): Error parsing data org.json.JSONException: Value [] of type org.json.JSONArray cannot be converted to JSONObject
01-03 16:50:09.239: E/JSON Parser2(17447): json: [][][]{"code":0,"message":"Segnalazione inviata correttamente"}
在php中我有:
$response = array();
$response["code"] = $e['code'];
$response["message"] = $e['message'];
echo json_encode($response);
谢谢