Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "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": "$540.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>rnrn<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>rn",
- "attribute_groups": [],
- "special": "",
- "discounts": [],
- "options": [
- {
- "name": "Size",
- "type": "select",
- "option_value": [
- {
- "image": "http://api.yellowskydemo.com/image/cache/no_image-100x100.jpg",
- "price": "$50.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": "$40.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"
- }
- }
- }
- 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
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement