How to obtain data from heavily nested collections

Hi,
please do you have any idea, how to get to these data?
The output from Baselinker API is heavily nested collection, simply I need to get two cycles somehow to get both products.(product_id).product_id and products.(product_id).quantity from both products.

Tried almost everything - iterator (doesn’t work since it’s for arrays, not collections, simply iterator doesn’t send the data to the following module), tried also toArray in the iterator, which brought some results, but also not simply accessible by other following modules.
Maybe somehow using map and toArray together? But I always got empty result. Or get?

blueprint (1).json (15.2 KB)

Thank you very much

Welcome to the Make community!

You are on the right track by using toArray, because the IDs are dynamic.

Now the iterator will output key and value.value, so you’ll need to manually type them out, like this question I just answered: Converting collection in array into plain text - #4 by samliew

If you need further assistance, please provide the following:

Could you also provide an example output bundle of module 67?

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!

3 Likes

Hey @Jan_Havlicek your steps to obtain the data is going in the right direction.
If you would use the Iterator and your toArray() function you get all your data in the Values object. This is then easily retrievable in the following modules. The ID would look something like:

{{get(map(70.value; "product_id");1)}}

Take a look at it and see if this helps you out :wink:

2 Likes

Hi Bjorn, it works flawlessly, thank you very much :slight_smile:

1 Like