我从PHP读取状态JSON格式,但总是得到:java.lang.Integer中不能被转换为JSONObject的
org.json.JSONException: Value 43 of type java.lang.Integer cannot be converted to JSONObject
我从JSON
读取结果的方式int strUserID;
......
strUserID = jsonObject.getInt("UserID");
而且在PHP我使用:
$user_id = mysql_insert_id();
echo $user_id;
if(!$objQuery)
{
$arr['StatusID'] = "0"; // unable to create user
}
else
{
$arr['StatusID'] = "1"; // user created successfully
$arr['UserID'] = $user_id; // passing user id to android app
}
JSON样本的网址:
46{"StatusID":"1","UserID":46}
但在Android方面没有得到数据转换成JSON格式,因为面临着异常
可我知道我在做什么错误?
可以添加你的'json'回应? – Rustam
发布您的** Json数据**。 – Pankaj
@Rustam检查以上 – Sophie