Simple collection question from a newbie!

Hello everyone,

I always get data back via an API request, how can I define such dynamic names in the array/collection as placeholders?

Here are 3 examples:

{{12.data.RAW.MATIC.USD.FROMSYMBOL}}
{{12.data.RAW.BTC.USD.FROMSYMBOL}}
{{12.data.RAW.ETH.USD.FROMSYMBOL}}

I was thinking of something like that:
{{12.data.RAW.data[].USD.FROMSYMBOL}}

Please give me a tip. I just can’t get any further with it.
I’ve already watched a lot of videos and read a lot of documentation.

But I have not yet been able to find an example like this!
It’s probably super simple :grinning:

Best regards,
Daniel

Welcome to the Make community!

Please provide the output bundles of the modules by running the scenario (or get from the scenario History tab), then click the white speech bubble on the top-right of each module and select “Download input/output bundles”.
Screenshot_2023-10-06_141025

A.

Save each bundle contents in your text editor as a bundle.txt file, and upload it here into this discussion thread.

Uploading them here will look like this:

module-1-output-bundle.txt (12.3 KB)

B.

If you are unable to upload files on this forum, alternatively you can paste the formatted bundles in this manner:

  • Either add three backticks ``` before and after the code, like this:

    ```
    input/output bundle content goes here
    ```

  • Or use the format code button in the editor:
    Screenshot_2023-10-02_191027

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

This will allow others to better assist you. Thanks!

samliewrequest private consultation

Join the unofficial Make Discord server to chat with other makers!

2 Likes

Thanks for your help - samliew!

[
    {
        "statusCode": 200,
        "headers": [
            {
                "name": "server",
                "value": "nginx"
            },
            {
                "name": "date",
                "value": "Wed, 22 May 2024 08:27:40 GMT"
            },
            {
                "name": "content-type",
                "value": "application/json; charset=UTF-8"
            },
            {
                "name": "transfer-encoding",
                "value": "chunked"
            },
            {
                "name": "connection",
                "value": "close"
            },
            {
                "name": "vary",
                "value": "Accept-Encoding"
            },
            {
                "name": "content-security-policy",
                "value": "frame-ancestors 'none'"
            },
            {
                "name": "access-control-allow-origin",
                "value": "*"
            },
            {
                "name": "access-control-allow-methods",
                "value": "GET, POST, OPTIONS"
            },
            {
                "name": "access-control-allow-headers",
                "value": "Content-Type, Cookie, Set-Cookie, Authorization"
            },
            {
                "name": "access-control-allow-credentials",
                "value": "true"
            },
            {
                "name": "cache-control",
                "value": "public, max-age=10"
            },
            {
                "name": "x-cryptocompare-cache-hit",
                "value": "false"
            },
            {
                "name": "x-cryptocompare-server-id",
                "value": "cc-api-min-v2-18"
            }
        ],
        "cookieHeaders": [],
        "data": {
            "BTC": {
                "USD": 69895.63,
                "EUR": 64308.78
            },
            "ETH": {
                "USD": 3751.17,
                "EUR": 3451.73
            },
            "ONDO": {
                "USD": 0.9246,
                "EUR": 0.8511
            },
            "NEAR": {
                "USD": 7.932,
                "EUR": 7.297
            },
            "OCEAN": {
                "USD": 1.05,
                "EUR": 0.9674
            },
            "SOL": {
                "USD": 179.83,
                "EUR": 165.46
            },
            "RNDR": {
                "USD": 11.17,
                "EUR": 10.29
            },
            "IMX": {
                "USD": 2.503,
                "EUR": 2.305
            },
            "LDO": {
                "USD": 2.142,
                "EUR": 1.974
            },
            "SSV": {
                "USD": 43.91,
                "EUR": 40.42
            },
            "FET": {
                "USD": 2.507,
                "EUR": 2.309
            },
            "CLORE": {
                "USD": 0.1813,
                "EUR": 0.167
            },
            "HBAR": {
                "USD": 0.1157,
                "EUR": 0.1065
            },
            "PYTH": {
                "USD": 0.4693,
                "EUR": 0.4321
            },
            "FTM": {
                "USD": 0.8638,
                "EUR": 0.7953
            },
            "GALA": {
                "USD": 0.04596,
                "EUR": 0.04232
            },
            "XRP": {
                "USD": 0.536,
                "EUR": 0.4939
            },
            "SEI": {
                "USD": 0.561,
                "EUR": 0.5166
            },
            "LTC": {
                "USD": 87.18,
                "EUR": 80.25
            },
            "XAI": {
                "USD": 0.7455,
                "EUR": 0.6864
            },
            "ILV": {
                "USD": 94.11,
                "EUR": 86.6
            },
            "APE": {
                "USD": 1.312,
                "EUR": 1.208
            },
            "PYR": {
                "USD": 4.824,
                "EUR": 4.438
            },
            "USDT": {
                "USD": 0.9998,
                "EUR": 0.9206
            },
            "LINK": {
                "USD": 16.71,
                "EUR": 15.38
            },
            "MANA": {
                "USD": 0.4672,
                "EUR": 0.4302
            },
            "CRO": {
                "USD": 0.126,
                "EUR": 0.1161
            },
            "QNT": {
                "USD": 99,
                "EUR": 91.22
            },
            "INJ": {
                "USD": 27.32,
                "EUR": 25.15
            },
            "DOT": {
                "USD": 7.627,
                "EUR": 7.024
            },
            "VET": {
                "USD": 0.03637,
                "EUR": 0.03349
            },
            "ARB": {
                "USD": 1.179,
                "EUR": 1.086
            },
            "TIA": {
                "USD": 9.665,
                "EUR": 8.909
            },
            "AVAX": {
                "USD": 41.1,
                "EUR": 37.85
            },
            "ADA": {
                "USD": 0.4892,
                "EUR": 0.4505
            },
            "API3": {
                "USD": 2.744,
                "EUR": 2.526
            },
            "MATIC": {
                "USD": 0.7287,
                "EUR": 0.6711
            },
            "BOME": {
                "USD": 0.01323,
                "EUR": 0.01218
            },
            "SATOX": {
                "USD": 0.0003055,
                "EUR": 0.0002813
            }
        },
        "fileSize": 1318
    }
]

(I didn’t see any “RAW” property under data in the output bundle you provided)

You can use the built-in function toArray to convert a collection into an array.

e.g.:

{{ toArray(12.data) }}

If there is a RAW property perhaps you can use the same function to also convert it into an array.

samliewrequest private consultation

Join the unofficial Make Discord server to chat with other makers!

2 Likes