请支持JsonRequest

时间:2015-08-17 07:28:35

标签: android json android-volley

我有以下json:

 {
     "code": "1",
     "status": "OK",
     "users": [
         {
             "id": "5",
             "yazi": "launcher",
             "gun": "2015-08-04"
         },
         {
             "id": "6",
             "yazi": "piano",
             "gun": "2015-02-02"
         },
         {
             "id": "9",
             "yazi": "text text",
             "gun": "2015-08-05"
         },
         {
             "id": "14",
             "yazi": null
             "gun": "2015-02-02"
         }
     ] }

我想如果代码为“1”且状态为“OK”,则查看用户参数。 我该怎么用?

2 个答案:

答案 0 :(得分:0)

使用此

    JSONObject obj=new JSONObject();
    String status=obj.getString("status");
    String code=obj.getString("code");
    if(code.equalsIgnoreCase("1") && status.equalsIgnoreCase("OK"))
    {
        //Parse your users array
    }

答案 1 :(得分:0)

以下是解析let controller = <your UICollectionViewController initialization> addChildViewController(controller) controller.view.frame = CGRectMake(...) //frame of UICollectionView you want it takes in main View view.addSubview(controller.view) controller.didMoveToParentViewController(self) 的代码:

JSONObject