试图从 JavaScript 中的 API 对象中获取深度嵌入的对象

Trying to get a deeply embedded object from API object in JavaScript

我正在尝试从这个 API 调用中提取 "quantity" 值 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
         }
       },

使用工具美化输出,帮助很大

这里有一个这样的工具http://jsbeautifier.org/

关于你的问题,你可以在这里访问:

data.results[0].quantity