开发者社区> 问答> 正文

Android这样的JSON数据应该怎么解析。

screenshot
这是一个选择添加疾病的页面。
第一行是疾病类型
第二行是疾病名称
要求上面的疾病类型和疾病名称都要从服务器获取。
每种疾病类型下面的疾病名称数量不确定

还有可以点击选择添加日期,不过这个问题我已经解决了。
我采用的是ListView展示的。但是解析过后有问题,只能解析到疾病类型,解析不到疾病名称。

每个疾病类型和疾病名称都有ID。
 这是用网页访问JSP网址的返回值。
{"code":200,"message":"调用成功","data":{"mem_message_records":[{"message_disease_typeid":"1","message_disease_type":"心血管系统"},{"message_disease_typeid":"2","message_disease_type":"外围血管疾病"},{"message_disease_typeid":"3","message_disease_type":"脑血管疾病"},{"message_disease_typeid":"4","message_disease_type":"肺部疾病"},{"message_disease_typeid":"5","message_disease_type":"代谢疾病"},{"message_disease_typeid":"6","message_disease_type":"周围神经疾病"},{"message_disease_typeid":"7","message_disease_type":"其他疾病"}],"mem_message_recordss":[[{"message_diseaseid":"1","message_disease":"冠状动脉疾病"},{"message_diseaseid":"2","message_disease":"心绞痛"},{"message_diseaseid":"3","message_disease":"心肌梗死"},{"message_diseaseid":"4","message_disease":"冠状动脉血运重建"},{"message_diseaseid":"5","message_disease":"充血性心力衰竭"}],[{"message_diseaseid":"6","message_disease":"闭塞性周围动脉粥样硬化"},{"message_diseaseid":"7","message_disease":"血栓行静脉炎"}],[{"message_diseaseid":"8","message_disease":"脑血栓"},{"message_diseaseid":"9","message_disease":"短暂性脑供血不足"},{"message_diseaseid":"10","message_disease":"脑出血"}],[{"message_diseaseid":"11","message_disease":"慢性支气管炎"},{"message_diseaseid":"12","message_disease":"慢性阻塞性肺病"},{"message_diseaseid":"13","message_disease":"支气管哮喘"},{"message_diseaseid":"14","message_disease":"间质性肺病"},{"message_diseaseid":"15","message_disease":"囊性肺纤维化"}],[{"message_diseaseid":"16","message_disease":"1型糖尿病"},{"message_diseaseid":"17","message_disease":"2型糖尿病"},{"message_diseaseid":"18","message_disease":"糖尿病肾病"}],[{"message_diseaseid":"19","message_disease":"糖尿病性周围精神病"},{"message_diseaseid":"20","message_disease":"自主神经性病变"}],[{"message_diseaseid":"21","message_disease":"高血压"},{"message_diseaseid":"22","message_disease":"视网膜病变"},{"message_diseaseid":"23","message_disease":"恶性肿瘤"},{"message_diseaseid":"24","message_disease":"脑卒中"},{"message_diseaseid":"25","message_disease":"重性精神疾病"},{"message_diseaseid":"26","message_disease":"结核病"},{"message_diseaseid":"27","message_disease":"肝炎"},{"message_diseaseid":"28","message_disease":"先天畸形"},{"message_diseaseid":"29","message_disease":"其它"}]]}}

展开
收起
杨冬芳 2016-07-07 11:01:54 2217 0
1 条回答
写回答
取消 提交回答
  • IT从业

    写一个类,结构和json格式对应,用gson直接转为对象,对于不定数量的用List就行了

    2019-07-17 19:52:38
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
58同城Android客户端Walle框架演进与实践之路 立即下载
Android组件化实现 立即下载
蚂蚁聚宝Android秒级编译——Freeline 立即下载

相关镜像