Extracting Multiple Items From Nested Collections In An Array

So I know this kind of question seems to get asked a lot around here, but in my specific case I can’t seem to find the exact answer I’m looking for.

What I’m trying to do is get a mappable output each of these “Long Name” Address Components from each collection of the “Address Components” array so I can populate address line fields on an invoice.

I know that achieving this likely uses some combination of an iterator, aggregator, and/or a JSON Parser, but I for the life of me can’t figure out the right combination. I can’t seem to wrap my head around the map function in combination with the aforementioned modules to get each value to have a unique mappable value.

Any help would be greatly appreciated!

For some added context, what I want to achieve is to be able to send each of these values into a Quickbooks “Create An Invoice” module to populate each of these different fields.

Welcome to the Make community!

Please provide the output bundles of the modules [6] by running the scenario, then click the white speech bubble on the top-right of each module, save the contents as a text .json file, and upload it here into this discussion thread:
Screenshot_2023-10-06_141025

Providing the output bundles will allow others to replicate what is going on in the scenario even if they do not use the external service (Google Maps).

This will allow others to better assist you. Thanks!

3 Likes

Absolutely! Here you go

[
    {
        "address_components": [
            {
                "long_name": "69",
                "short_name": "69",
                "types": [
                    "street_number"
                ]
            },
            {
                "long_name": "Murray Avenue",
                "short_name": "Murray Ave",
                "types": [
                    "route"
                ]
            },
            {
                "long_name": "Larchmont",
                "short_name": "Larchmont",
                "types": [
                    "locality",
                    "political"
                ]
            },
            {
                "long_name": "Mamaroneck",
                "short_name": "Mamaroneck",
                "types": [
                    "administrative_area_level_3",
                    "political"
                ]
            },
            {
                "long_name": "Westchester County",
                "short_name": "Westchester County",
                "types": [
                    "administrative_area_level_2",
                    "political"
                ]
            },
            {
                "long_name": "New York",
                "short_name": "NY",
                "types": [
                    "administrative_area_level_1",
                    "political"
                ]
            },
            {
                "long_name": "United States",
                "short_name": "US",
                "types": [
                    "country",
                    "political"
                ]
            },
            {
                "long_name": "10538",
                "short_name": "10538",
                "types": [
                    "postal_code"
                ]
            },
            {
                "long_name": "2213",
                "short_name": "2213",
                "types": [
                    "postal_code_suffix"
                ]
            }
        ],
        "formatted_address": "69 Murray Ave, Larchmont, NY 10538, USA",
        "geometry": {
            "bounds": {
                "northeast": {
                    "lat": 40.9363233,
                    "lng": -73.76141129999999
                },
                "southwest": {
                    "lat": 40.93618410000001,
                    "lng": -73.76169639999999
                }
            },
            "location": {
                "lat": 40.9362461,
                "lng": -73.7616216
            },
            "location_type": "ROOFTOP",
            "viewport": {
                "northeast": {
                    "lat": 40.9376026802915,
                    "lng": -73.76020486970849
                },
                "southwest": {
                    "lat": 40.93490471970851,
                    "lng": -73.7629028302915
                }
            }
        },
        "place_id": "ChIJtbigOxeSwokR_zhKVtGi0Bg",
        "types": [
            "premise"
        ],
        "urlMap": "https://maps.google.com/?q=40.9362461,-73.7616216"
    }
]

Use the toCollection built-in function:

Output:

1 Like

You are a literal life saver.

THANK YOU SO MUCH :blush:

No problem, glad I could help!

3 Likes