如何解析从URL?它包含数组数JSON数据 [英] How to parse Json data from URL?which contains number of arrays

查看:154
本文介绍了如何解析从URL?它包含数组数JSON数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有解析JSON数据的问题,我也跟着链接。

i am having a issue of parsing JSON data i followed this link..

在那边已经分析的数据图像的描述。

over there it has parsing data images description..

和我也审阅这个堆栈过流谁是有同样的问题,但没有正确的答案一个人.. <一href="http://stackoverflow.com/questions/20699627/how-to-parse-jsonarray-inside-jsonarray-in-android">How解析JSONarray内JSONarray在Android的?并 <一href="http://stackoverflow.com/questions/20716333/how-to-display-image-from-url/20716395?noredirect=1#comment31033707_20716395">How从URL显示图像?

and i also refereed this in stack over flow a guy who is having same issue but no correct answer.. How to Parse JSONarray inside JSONarray in android? and How to display Image from URL?

我们可以说,上述问题只是延伸。

we can say just extention of the above questions..

它不是一个重复的那家伙也是同样的问题,没有答案。

its not a duplicate that guy is also same problem no answer..

我有像下面

{
"request": "ok",
"query": {
    "result": [
        {
            "site": [
                {
                    "latest": [
                        {
                            "id": "2eaQy8Ow",
                            "data": "1/1/2014"
                        }
                    ]
                }
            ],
            "flag": [
                "http://www.simplydecoded.com/wp-content/uploads/2013/02/Telangana2.jpg"
            ]
        }
    ]
   }
  }

我用下面code解析

i am using below code for parsing

JSONArray json_query_flag = c.getJSONArray("flag");


JSONArray json_query_site=c.getJSONArray("site");
System.out.println("looping json_query_site");
for (int j = 0; j < c.length(); j++) {
System.out.println("looping json_query_site[" + j +"]" + "json_query_site.length() -->" + json_query_site.length());

if (j <json_query_site.length()) {

HashMap<String, String> map1 = new HashMap<String, String>();
JSONObject sd = json_query_site.getJSONObject(j);

// get latestoffers
JSONArray json_latest = sd.getJSONArray("latest");
System.out.println(json_latest.toString());

for (int k = 0; k < json_latest.length(); k++) {

HashMap<String, String> map2 = new HashMap<String, String>();
JSONObject e = json_latest.getJSONObject(k);

我的问题是,我没有得到的最​​新标志.. 可解析的问题。

My problem is that i am not getting the latest and flag.. may be parsing problem..

推荐答案

Hellow人感谢理解问题请按照<一href="http://stackoverflow.com/questions/20699627/how-to-parse-jsonarray-inside-jsonarray-in-android">this张贴的,直到你的网站,最新的..

Hellow man thanks for understanding the problem please follow this post for the till your site and latest..

它解决了我得到的文本..但问题的图像,我认为你有标志.. 对于您需要更改您的Listviewadapter.java文件。使图像将显示

it solved I am getting text.. but problem with images I think you have flag.. for that you need to change your Listviewadapter.java file. so that images will appear

改变这种像

String strflag = resultp.get(Mainactivity.IMAGES);
    if(strflag != null)
        imageLoader.DisplayImage(strflag, flag);
    else
        imageLoader.DisplayImage("http://www.butterentals.com/graphics/no_image.jpg", flag);

这样我会做。

so that I will be done.

这篇关于如何解析从URL?它包含数组数JSON数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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