首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >试图从JavaScript中的API对象中获取深度嵌入的对象

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

Stack Overflow用户
提问于 2015-01-05 06:34:37
回答 1查看 55关注 0票数 0

我正试图用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
         }
       },
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-01-05 06:39:29

使用工具美化输出,这是很有帮助的。

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

至于你的问题,你可以在这里查阅:

代码语言:javascript
复制
data.results[0].quantity
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27774499

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档