如何从一个网址到Android设备解析只有一些选定的Json数组和JSON对象 [英] How to Parse only some selected Json arrays and Json Objects from a Url to android device

查看:98
本文介绍了如何从一个网址到Android设备解析只有一些选定的Json数组和JSON对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个JSON数据和一个包含多个JSON阵列和JSON对象,所以我想分析其中的一些在Android活动,...

JSON数组和JSON的实例对象在这里 p>

所以,我想打电话给他们中的一些在Android设备....
我知道如何解析,但我只想要一些内容。

我有一个像

数据

  {
   过程:完成
    一:1
   清单:{
    东西:
        {
            名称:约翰,
            手机:测试
        }
    ]
     细节:OK
     二:2
    SomethingElse:[
        {
            名称:史密斯
            手机:测试
        }
    ]
   }
  }

喜欢,我有一个RESTful服务,它有大量的数据,的..所以,如果要称之为列表或SomethingElsejsonObjecs /阵列....它不是调用它在启动strucking,..


解决方案

您可以考虑分析数据的方式SAX,只是去通过你的节点,如果您需要分析它是什么,否则跳过它,并继续下去。这里看看, JSONReader是要走的路。

I have a Json data and which contains multiple JSON arrays and JSON Objects so i want to parse some of them in an android activity ,...

Example of JSON array and Json objects at here

So i want to call some of them in the android device.... i know how to parse but i want only some of contents ,..

I have the data like

 {
   "process":"done"
    "one":1
   "List": {
    "Something": [
        {
            "Name": "John",
            "phone": "test"
        }
    ]
     "details":"ok"
     "two":2 
    "SomethingElse": [
        {
            "Name": "Smith",
            "phone": "test"
        }
    ]
   }
  }

Like that i have a Restful service and it has lot of data ,.. so if want to call "list" or "SomethingElse" jsonObjecs/arrays.... its not calling its strucking at starting,..

解决方案

You could consider parsing your data the SAX way, just go through your nodes, if it's what you need parse it, otherwise skip it and go on. Have a look here, JSONReader is the way to go.

这篇关于如何从一个网址到Android设备解析只有一些选定的Json数组和JSON对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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