Java android中的json解析提供类型不匹配

Java android中的json解析提供类型不匹配,java,android,json,Java,Android,Json,我正在解析一个json字符串。当我运行代码时,我接收到json异常,该异常表示在从json对象获取json数组的点上存在类型不匹配。 这是我的密码 String dataFromLogin="{"catego":{"id":"2","fname":"Tashen Jazbi","uname":"tashen", "password":"123","pic_url":"","lati":"33.7167","longi":"73.0667","city":"Islamabad",

我正在解析一个json字符串。当我运行代码时,我接收到json异常,该异常表示在从json对象获取json数组的点上存在类型不匹配。 这是我的密码

String dataFromLogin="{"catego":{"id":"2","fname":"Tashen Jazbi","uname":"tashen",
    "password":"123","pic_url":"","lati":"33.7167","longi":"73.0667","city":"Islamabad",
    "country":"Pakistan","mobid":"000000000000000","street":"xyz",
    "dateandtime":"2013-12-29 18:07:52"}}";

try {
    JSONObject jsonObj = new JSONObject(dataFromLogin);
    //JSONObject response = jsonObj.getJSONObject("catego");
    JSONArray contacts = jsonObj.getJSONArray("catego");
    for (int i = 0; i < contacts.length(); i++) {
        JSONObject c = contacts.getJSONObject(i);

        fullname = c.getString("fname");

        uname = c.getString("uname");
        pic_url = c.getString("pic_url");

        lat = c.getString("lati");
        lng = c.getString("longi");

        city = c.getString("city");

        country = c.getString("country");

        street= c.getString("street");
    }

} catch (JSONException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}
我找不到我哪里做错了。如果有人能帮忙,我们将不胜感激

谢谢:

JSONArray contacts = jsonObj.getJSONArray("catego");
catego是一个jsonobject

{表示json对象节点

[表示json数组节点

使用以下命令:

JSONObject response = jsonObj.getJSONObject("catego");
因为catego是一个对象而不是数组