Extract Data from Doubly Nested Objects

Hi,

I have data in the following structure:

[
    {
        "statusCode": 200,
        "headers": [
            {
                "name": "content-encoding",
                "value": "br"
            },
            {
                "name": "etag",
                "value": "\"xyz\""
            },
            {
                "name": "content-type",
                "value": "application/json"
            },
            {
                "name": "vary",
                "value": "Origin, Accept-Encoding"
            },
            {
                "name": "x-business-use-case-usage",
                "value": "{\"xyz\":[{\"type\":\"pages\",\"call_count\":1,\"total_cputime\":1,\"total_time\":1,\"estimated_time_to_regain_access\":0}]}"
            },
            {
                "name": "access-control-allow-origin",
                "value": "*"
            },
            {
                "name": "facebook-api-version",
                "value": "v20.0"
            },
            {
                "name": "strict-transport-security",
                "value": "max-age=15552000; preload"
            },
            {
                "name": "pragma",
                "value": "no-cache"
            },
            {
                "name": "cache-control",
                "value": "private, no-cache, no-store, must-revalidate"
            },
            {
                "name": "expires",
                "value": "Sat, 01 Jan 2000 00:00:00 GMT"
            },
            {
                "name": "x-fb-request-id",
                "value": "xyz"
            },
            {
                "name": "x-fb-trace-id",
                "value": "xyz"
            },
            {
                "name": "x-fb-rev",
                "value": "xyz"
            },
            {
                "name": "x-fb-debug",
                "value": "xyz"
            },
            {
                "name": "x-fb-server-load",
                "value": "38"
            },
            {
                "name": "date",
                "value": "Tue, 23 Jul 2024 14:03:21 GMT"
            },
            {
                "name": "x-fb-connection-quality",
                "value": "EXCELLENT; q=0.9, rtt=20, rtx=0, c=10, mss=1380, tbw=7244, tp=-1, tpl=-1, uplat=384, ullat=0"
            },
            {
                "name": "alt-svc",
                "value": "h3=\":443\"; ma=86400"
            },
            {
                "name": "connection",
                "value": "keep-alive"
            },
            {
                "name": "content-length",
                "value": "519"
            }
        ],
        "cookieHeaders": [],
        "data": {
            "data": [
                {
                    "name": "post_impressions_unique",
                    "period": "lifetime",
                    "values": [
                        {
                            "value": 153
                        }
                    ],
                    "title": "Lifetime Reel Total Reach",
                    "description": "Lifetime: The number of people who saw your reel at least once, whether or not your reel was played. People reached is different from impressions, which may include multiple views of your reel by the same people",
                    "id": "xyz/video_insights/post_impressions_unique/lifetime"
                },
                {
                    "name": "fb_reels_total_plays",
                    "period": "lifetime",
                    "values": [
                        {
                            "value": 182
                        }
                    ],
                    "title": "Lifetime Plays",
                    "description": "The number of times your reel starts to play after an impression is already counted.This is defined as reel sessions with 1ms or more and includes replays. Replays are counted after the initial play of the reel in the same session.",
                    "id": "xyz/video_insights/fb_reels_total_plays/lifetime"
                },
                {
                    "name": "post_video_likes_by_reaction_type",
                    "period": "lifetime",
                    "values": [
                        {
                            "value": {
                                "REACTION_LIKE": 1
                            }
                        }
                    ],
                    "title": "Lifetime Reactions",
                    "description": "Lifetime: The number of reactions on your reel. The reactions button on a reel allows people to share different reactions to its content: like, love, haha, wow, sad or angry.",
                    "id": "xyz/video_insights/post_video_likes_by_reaction_type/lifetime"
                }
            ]
        },
        "fileSize": 1259
    }
]

I would like to put the data in Google Sheet:

post_impressions_unique : 153
fb_reels_total_plays : 182
REACTION_LIKE : 1

How to collect data from doubly nested objects?

Hi,

You have different structures for
post_impressions_unique : 153
fb_reels_total_plays : 182
and
REACTION_LIKE : 1

So you should use combination of the Iterator module and Get() function with proper filters.

SC_2

Thanks for the tip. I found another solution :wink:

That’s awesome to hear! Would you mind sharing a brief summary of what did the trick for you for the benefit of the community?

Thanks a lot :raised_hands:

1 Like