首页 > 移动平台 > 详细

AppInventor2操作json数据

时间:2021-06-16 22:03:35      阅读:51      评论:0      收藏:0      [点我收藏+]

AppInventor2操作json数据

测试的json文本:

{
    "data": [
        {
            "pinned": false,
            "post_hint": "rich:video",
            "preview": {
                "enabled": false,
                "images": [
                    {
                        "id": "kFH7UID4C_mvoYUHTD-Oqf8AZ1CV-ooWlUykcZg1fbg",
                        "resolutions": [
                            {
                                "height": 81,
                                "url": "https://external-preview.redd.it/pFxri6KVX9ZHpHH6pR2J_BG3k_wEqvLZo69i2ipyA3Q.jpg",
                                "width": 108
                            },
                            {
                                "height": 162,
                                "url": "https://external-preview.redd.it/pFxri6KVX9ZHpHH6pR2J_BG3k_wEqvLZo69i2ipyA3Q.jpg",
                                "width": 216
                            },
                            {
                                "height": 240,
                                "url": "https://external-preview.redd.it/pFxri6KVX9ZHpHH6pR2J_BG3k_wEqvLZo69i2ipyA3Q.jpg",
                                "width": 320
                            }
                        ],
                        "source": {
                            "height": 360,
                            "url": "https://external-preview.redd.it/pFxri6KVX9ZHpHH6pR2J_BG3k_wEqvLZo69i2ipyA3Q.jpg",
                            "width": 480
                        },
                        "variants": {}
                    }
                ]
            },
            "pwls": 6,
            "retrieved_on": 1623815633,
            "score": 61,
            "secure_media": {
                "oembed": {
                    "author_name": "nipafx",
                    "author_url": "https://www.youtube.com/c/nipafx",
                    "height": 200,
                    "provider_name": "YouTube",
                    "provider_url": "https://www.youtube.com/",
                    "thumbnail_height": 360,
                    "thumbnail_url": "https://i.ytimg.com/vi/KG24inClY2M/hqdefault.jpg",
                    "thumbnail_width": 480,
                    "title": "The State of Project Loom with Ron Pressler",
                    "type": "video",
                    "version": "1.0",
                    "width": 356
                },
                "type": "youtube.com"
            },
            "secure_media_embed": {
                "height": 200,
                "media_domain_url": "https://www.redditmedia.com/mediaembed/o0m6g8",
                "scrolling": false,
                "width": 356
            },
            "selftext": "",
            "send_replies": true,
            "spoiler": false,
            "stickied": false,
            "subreddit": "java",
            "subreddit_id": "t5_2qhd7",
            "subreddit_subscribers": 234484,
            "subreddit_type": "public",
            "thumbnail": "image",
            "thumbnail_height": 105,
            "thumbnail_width": 140,
            "title": "The State of Project Loom with Ron Pressler",
            "total_awards_received": 0,
            "treatment_tags": [],
            "upvote_ratio": 0.92,
            "url": "https://www.youtube.com/watch?v=KG24inClY2M",
            "url_overridden_by_dest": "https://www.youtube.com/watch?v=KG24inClY2M",
            "whitelist_status": "all_ads",
            "wls": 6
        }
    ]
}

目的:获取红框数据(以列表类型存储)

基本的代码块为:

技术分享图片

获取不同层次里的数据只需在创建列表处更改代码:

每深入一层则在创建列表处向下添加路径,遇到中括号则需要用到 “本层所有键” 这个模块。


1.第一种情况:

技术分享图片

代码块:

技术分享图片


2.第二种情况:

技术分享图片

代码块:

技术分享图片


3.第三种情况:

技术分享图片

代码块:

技术分享图片


4.第四种情况:

技术分享图片

代码块:

技术分享图片


5.第五种情况:

技术分享图片

代码块:

技术分享图片

AppInventor2操作json数据

原文:https://www.cnblogs.com/harglo/p/14890324.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!