Попытка получить глубоко внедренный объект из объекта API в JavaScript

Я пытаюсь извлечь значение «количества» из этого вызова API с помощью JavaScript, но, похоже, я не могу понять это. Кто-нибудь готов принять вызов?

     {
   "count": 5,
   "results": [{
         "listing_id": 216653218,
         "state": "active",
         "user_id": 57517426,
         "category_id": 69150359,
         "title": "Foodie Dice",
         "description": "Some discription.",
         "creation_tsz": 1419964059,
         "ending_tsz": 1430414859,
         "original_creation_tsz": 1419964059,
         "last_modified_tsz": 1420033299,
         "price": "25.00",
         "currency_code": "USD",
         "**quantity**": 1,
         "tags": [],
         "category_path": ["Geekery"],
         "category_path_ids": [69150359],
         "materials": [],
         "shop_section_id": null,
         "featured_rank": null,
         "state_tsz": 1419964059,
         "url": "https://www.etsy.com/listing/216653218/foodie-dice?utm_source=buddhabar&utm_medium=api&utm_campaign=api",
         "views": 1,
         "num_favorers": 0,
         "shipping_template_id": null,
         "processing_min": 1,
         "processing_max": 1,
         "who_made": "i_did",
         "is_supply": "false",
         "when_made": "2010_2015",
         "is_private": false,
         "recipient": null,
         "occasion": null,
         "style": null,
         "non_taxable": false,
         "is_customizable": false,
         "is_digital": false,
         "file_data": "",
         "language": "en-US",
         "has_variations": false,
         "used_manufacturer": false,
         "MainImage": {
           "listing_image_id": 704444582,
           "hex_code": null,
           "red": null,
           "green": null,
           "blue": null,
           "hue": null,
           "saturation": null,
           "brightness": null,
           "is_black_and_white": null,
           "creation_tsz": null,
           "listing_id": 216653218,
           "rank": null,
           "url_75x75": "https://img0.etsystatic.com/048/0/10392050/il_75x75.704444582_poqv.jpg",
           "url_170x135": "https://img0.etsystatic.com/048/0/10392050/il_170x135.704444582_poqv.jpg",
           "url_570xN": "https://img0.etsystatic.com/048/0/10392050/il_570xN.704444582_poqv.jpg",
           "url_fullxfull": "https://img0.etsystatic.com/048/0/10392050/il_fullxfull.704444582_poqv.jpg",
           "full_height": null,
           "full_width": null
         }
       },

person ReganPerkins    schedule 05.01.2015    source источник


Ответы (1)


Используйте инструмент для украшения вывода, это очень помогает.

Один из таких инструментов здесь http://jsbeautifier.org/.

Что касается вашего вопроса, вы можете получить к нему доступ здесь:

data.results[0].quantity
person Antiga    schedule 05.01.2015