Android:JSONArray解析问题 [英] Android: Issue with JSONArray parsing

查看:122
本文介绍了Android:JSONArray解析问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是android新手,在Json解析中遇到了一些问题.

I am new to android and stuck with some problem in Json parsing.

JSONArray resultJsonArray = data.getJSONArray("detailsArr");

getJSONArray显示为红色,这意味着getJSONArray存在问题.但是我无法解决.

getJSONArray is showing in red colour it means some issue is with getJSONArray. But I am not able to resolve it.

JSON:

{"msg":"","status":true,"result":[{"conversation":"<p>sani<\/p>","attachmentName":"","attachmentURL":"","clientType":"student","repliedOn":"30-Sep-15 11:19AM","expertName":"shubham goyal","expertPic":""},{"conversation":"<p>rere<\/p>","attachmentName":"","attachmentURL":"","clientType":"expert","repliedOn":"1-Oct-15 5:31PM","expertName":"shubham goyal","expertPic":""},{"conversation":"<p>all vl<\/p>","attachmentName":"","attachmentURL":"","clientType":"student","repliedOn":"1-Oct-15 5:44PM","expertName":"shubham goyal","expertPic":""},{"conversation":"<p>asa kk<\/p>","attachmentName":"","attachmentURL":"","clientType":"expert","repliedOn":"1-Oct-15 5:45PM","expertName":"shubham goyal","expertPic":""}]}

推荐答案

捆绑没有方法getJSONArray()

并且您的JSON字符串不包含名为detailsArr的键.

And your JSON string doesn't contain a key named detailsArr.

更新:

我想你想做的是这样

JSONArray resultJsonArray = new JSONObject(data.getString("detailsArr"))
        .getJSONArray("result");

这篇关于Android:JSONArray解析问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆