如何从 json 数据中获取给定的低于值?

How to get a given below value from json data?

我需要获取图像数组数据如何放入适配器而不需要适配器代码?只有循环以及如何添加对我来说很重要 然后在第二秒之后我可以访问 option_value 数组。 首先可以访问所有图像,然后在 option_value 数组之后。

  {
    "success": true,
    "data": {
        "id": "50",
        "seo_h1": "",
        "name": "Shirt 10001",
        "manufacturer": "",
        "sku": "",
        "model": "10001",
        "image": "http://api.yellowskydemo.com/image/cache/data/shirts/7228-500x500.jpg",
        "images": [
            "http://api.yellowskydemo.com/image/cache/data/shirts/13-500x500.jpg",
            "http://api.yellowskydemo.com/image/cache/data/shirts/302-500x500.jpg",
            "http://api.yellowskydemo.com/image/cache/data/shirts/5-500x500.jpg",
            "http://api.yellowskydemo.com/image/cache/data/shirts/205-500x500.jpg"
        ],
        "price": "0.00",
        "rating": 0,
        "description": "<p>Fasten your fashion belts, for this is the ultimate edit of swanky casual wear by Ralph Lauren! For men who are born with a strong sense of style, the American powerhouse packs a colourful punch with this high-fash collection of shirts and sporty, monogrammed polos.</p>\r\n\r\n<p>Fasten your fashion belts, for this is the ultimate edit of swanky casual wear by Ralph Lauren! For men who are born with a strong sense of style, the American powerhouse packs a colourful punch with this high-fash collection of shirts and sporty, monogrammed polos.</p>\r\n",
        "attribute_groups": [],
        "special": "",
        "discounts": [],
        "options": [
            {
                "name": "Size",
                "type": "select",
                "option_value": [
                    {
                        "image": "http://api.yellowskydemo.com/image/cache/no_image-100x100.jpg",
                        "price": ".00",
                        "price_prefix": "-",
                        "product_option_value_id": "17",
                        "option_value_id": "55",
                        "name": "L-40",
                        "quantity": "99"
                    },
                    {
                        "image": "http://api.yellowskydemo.com/image/cache/no_image-100x100.jpg",
                        "price": ".00",
                        "price_prefix": "+",
                        "product_option_value_id": "18",
                        "option_value_id": "57",
                        "name": "XXL-44",
                        "quantity": "100"
                    }
                ],
                "required": "1",
                "product_option_id": "227",
                "option_id": "14"
            }
        ],
        "minimum": "1",
        "meta_description": "",
        "meta_keyword": "",
        "tag": "",
        "upc": "",
        "ean": "",
        "jan": "",
        "isbn": "",
        "mpn": "",
        "location": "",
        "stock_status": "Out Of Stock",
        "manufacturer_id": null,
        "tax_class_id": "0",
        "date_available": "2014-08-12",
        "weight": "0.00000000",
        "weight_class_id": "1",
        "length": "0.00000000",
        "width": "0.00000000",
        "height": "0.00000000",
        "length_class_id": "1",
        "subtract": "0",
        "sort_order": "1",
        "status": "1",
        "date_added": "2014-08-13 12:05:56",
        "date_modified": "2015-06-30 11:19:39",
        "viewed": "8",
        "weight_class": "kg",
        "length_class": "cm",
        "reward": "0",
        "points": "0",
        "category": [
            {
                "name": "Shirts",
                "id": "59"
            },
            {
                "name": "Casual Shirts",
                "id": "60"
            }
        ],
        "quantity": "99",
        "reviews": {
            "review_total": "0"
        }
    }
}

你真的应该看看 android 中的如何解析 JsonObject / JsonArray。

请把你尝试过的代码也放上去,因为这里的人是来帮助解决问题的 error/problem 而不是编码。

这是您可以从中解析您的 json

的代码
JSONObject jsonObject = new JSONObject();
JSONObject dataObject = jsonObject.getJSONObject("data");
JSONArray imagesArray = dataObject.getJSONArray("images");
ArrayList<String> listOfImagesUrl = new ArrayList<>();
for(int i = 0; i < imagesArray.length(); i++)
{
     listOfImagesUrl.add(imagesArray.getString(i)); // listOfImages
}

// 选项值代码

JSONArray optionsArray = dataObject.getJSONArray("options");
for(int i = 0; i < optionsArray.length(); i++)
{
   JSONObject option = optionsArray.getJSONObject(i);
   JSONArray optionsValueArray = option.getJSONArray("option_value");
   for(int j = 0 ; j < optionsValueArray.length(); j++)
   {
      JSONObject optionValueObject = optionsValueArray.getJSONObject(j);
      String image = optionValueObject.getString("image");
      String price = optionValueObject.getString("price");
      String price_prefix = optionValueObject.getString("price_prefix");
      //same like this
   }
}