【问题标题】:How to parse the below mentioned php file using JSON parsing in android [closed]如何在android中使用JSON解析来解析下面提到的php文件[关闭]
【发布时间】:2014-05-13 05:24:56
【问题描述】:
{
    "category": [
        [
            "Item 1"
        ],
        [
            "Item 2"
        ],
        [
            "Item 3"
        ],
        [
            "Item 4"
        ],
        [
            "Item 5"
        ]
    ]
}

如何使用 JSON Parsing 解析此类数据?将来可以将项目添加到类别中。 我是 JSON 解析的新手。所以请详细解释一下。 提前致谢。

【问题讨论】:

标签: php android json


【解决方案1】:
// try this way,hope this will help you...

try{
   JSONArray category = new JSONObject (jsonRespone).getJSONArray("category");
   for (int i=0;i<category.length();i++){
        System.out.println(i+" Value Is :"+category.getJSONArray(i).getString(0));
   }
}catch (Throwable e){
   e.printStackTrace();
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-08-04
    • 2014-05-10
    • 1970-01-01
    • 1970-01-01
    • 2012-08-12
    • 1970-01-01
    • 2023-04-01
    • 2012-05-01
    相关资源
    最近更新 更多