Bundles to associative array

Hi !

Sorry if there is already a similar topic. I am French and I don’t think I found anything in my searches.

I retrieve lines from a Notion database (but I guess it doesn’t matter where it comes from), in the form:
col: KEY | VALUE
row1: key1 | value1
row2: key2 | value2
row3: key3 | value3
etc.

I would like to transform this into an associative array. Then, I want that by entering keyN it returns valueN.

Do you know if it is possible to do this?

Thank you very much for your attention.

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”.

A. Upload as Text File

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

B. Insert as Formatted Code Block

If you are unable to upload files on this forum, alternatively you can paste the formatted bundles.
These are the two ways to format text so that it won’t be modified by the forum:

  • Method 1: Type code block manually

    Add three backticks ``` before and after the content/bundle, like this:

    ```
    content goes here
    ```

  • Method 2. Highlight and click the format button in the editor

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!

Hope this helps! Let me know if there are any further questions or issues.

@samliew


P.S.: Did you know, the concepts of about 70% of questions asked on this forum are already covered in the Make Academy. Investing some effort into it will save you lots of time and frustration using Make later!

Thank you samilew…

here is the bundles :

[
    {
        "object": "page",
        "id": "notion table id",
        "created_time": "2024-08-28T15:18:00.000Z",
        "last_edited_time": "2024-08-31T00:45:00.000Z",
        "created_by": {
            "object": "user",
            "id": "notion user id"
        },
        "last_edited_by": {
            "object": "user",
            "id": "notion user id"
        },
        "cover": null,
        "icon": null,
        "parent": {
            "type": "database_id",
            "database_id": "parent id"
        },
        "archived": false,
        "in_trash": false,
        "properties": [
            {
                "id": "Mnck",
                "type": "checkbox",
                "checkbox": true,
                "label": "Accueil"
            },
            {
                "id": "rUtu",
                "type": "rich_text",
                "rich_text": [
                    {
                        "type": "text",
                        "text": {
                            "content": "3",
                            "link": null
                        },
                        "annotations": {
                            "bold": false,
                            "italic": false,
                            "strikethrough": false,
                            "underline": false,
                            "code": false,
                            "color": "default"
                        },
                        "plain_text": "3",
                        "href": null
                    }
                ],
                "label": "Valeur"
            },
            {
                "id": "title",
                "type": "title",
                "title": [
                    {
                        "type": "text",
                        "text": {
                            "content": "Nb_conseils",
                            "link": null
                        },
                        "annotations": {
                            "bold": false,
                            "italic": false,
                            "strikethrough": false,
                            "underline": false,
                            "code": false,
                            "color": "default"
                        },
                        "plain_text": "Nb_conseils",
                        "href": null
                    }
                ],
                "label": "Identifiant"
            }
        ],
        "url": "https://www.notion.so/Nb_conseils-somerandomstring",
        "public_url": null,
        "properties_value": {
            "Accueil": true,
            "Valeur": [
                {
                    "type": "text",
                    "text": {
                        "content": "3",
                        "link": null
                    },
                    "annotations": {
                        "bold": false,
                        "italic": false,
                        "strikethrough": false,
                        "underline": false,
                        "code": false,
                        "color": "default"
                    },
                    "plain_text": "3",
                    "href": null
                }
            ],
            "Identifiant": [
                {
                    "type": "text",
                    "text": {
                        "content": "Nb_conseils",
                        "link": null
                    },
                    "annotations": {
                        "bold": false,
                        "italic": false,
                        "strikethrough": false,
                        "underline": false,
                        "code": false,
                        "color": "default"
                    },
                    "plain_text": "Nb_conseils",
                    "href": null
                }
            ]
        },
        "__IMTLENGTH__": 2,
        "__IMTINDEX__": 1
    },
    {
        "object": "page",
        "id": "notion row id",
        "created_time": "2024-08-02T11:45:00.000Z",
        "last_edited_time": "2024-08-28T14:48:00.000Z",
        "created_by": {
            "object": "user",
            "id": "notion user id"
        },
        "last_edited_by": {
            "object": "user",
            "id": "notion user id"
        },
        "cover": null,
        "icon": null,
        "parent": {
            "type": "database_id",
            "database_id": "notion database id"
        },
        "archived": false,
        "in_trash": false,
        "properties": [
            {
                "id": "Mnck",
                "type": "checkbox",
                "checkbox": true,
                "label": "Accueil"
            },
            {
                "id": "rUtu",
                "type": "rich_text",
                "rich_text": [
                    {
                        "type": "text",
                        "text": {
                            "content": "Femmes actives et urbaines dans la trentaine.",
                            "link": null
                        },
                        "annotations": {
                            "bold": false,
                            "italic": false,
                            "strikethrough": false,
                            "underline": false,
                            "code": false,
                            "color": "default"
                        },
                        "plain_text": "Femmes actives et urbaines dans la trentaine.",
                        "href": null
                    }
                ],
                "label": "Valeur"
            },
            {
                "id": "title",
                "type": "title",
                "title": [
                    {
                        "type": "text",
                        "text": {
                            "content": "Cible",
                            "link": null
                        },
                        "annotations": {
                            "bold": false,
                            "italic": false,
                            "strikethrough": false,
                            "underline": false,
                            "code": false,
                            "color": "default"
                        },
                        "plain_text": "Cible",
                        "href": null
                    }
                ],
                "label": "Identifiant"
            }
        ],
        "url": "https://www.notion.so/Cible-somerandomstring",
        "public_url": null,
        "properties_value": {
            "Accueil": true,
            "Valeur": [
                {
                    "type": "text",
                    "text": {
                        "content": "Femmes actives et urbaines dans la trentaine.",
                        "link": null
                    },
                    "annotations": {
                        "bold": false,
                        "italic": false,
                        "strikethrough": false,
                        "underline": false,
                        "code": false,
                        "color": "default"
                    },
                    "plain_text": "Femmes actives et urbaines dans la trentaine.",
                    "href": null
                }
            ],
            "Identifiant": [
                {
                    "type": "text",
                    "text": {
                        "content": "Cible",
                        "link": null
                    },
                    "annotations": {
                        "bold": false,
                        "italic": false,
                        "strikethrough": false,
                        "underline": false,
                        "code": false,
                        "color": "default"
                    },
                    "plain_text": "Cible",
                    "href": null
                }
            ]
        },
        "__IMTLENGTH__": 2,
        "__IMTINDEX__": 2
    }
]

“Identifiant” for my array keys
“Valeur” for my array values

Actually there are 2 bundles. Keys are “Cible” and “Nb_conseils” and values are “Femmes actives et urbaines dans la trentaine.” and “1”.

Which output do you prefer?

1.

Screenshot_2024-09-01_190951

2.

Screenshot_2024-09-01_190905

Yes, that is possible. You’ll need a minimum of three modules:

This is just an example. Your final solution may or may not look like this depending on your requirements.

Module Export - quick import into your scenario

You can copy and paste this module export into your scenario. This will import the modules (with fields/settings/filters) shown in my screenshots above.

  1. Move your mouse over the line of code below. Copy the JSON by clicking the copy button on the right of the code, which looks like this:

  2. Enter your scenario editor. Press ESC to close any dialogs. Press CTRLV (paste keyboard shortcut for Windows) to paste directly in the editor.

  3. Click on each imported module and re-save it for validation. There may be some errors prompting you to remap some variables and connections.

JSON module export — paste this directly in your scenario

{"subflows":[{"flow":[{"id":37,"module":"json:ParseJSON","version":1,"parameters":{"type":""},"mapper":{"json":"[{\"object\":\"page\",\"id\":\"notion table id\",\"created_time\":\"2024-08-28T15:18:00.000Z\",\"last_edited_time\":\"2024-08-31T00:45:00.000Z\",\"created_by\":{\"object\":\"user\",\"id\":\"notion user id\"},\"last_edited_by\":{\"object\":\"user\",\"id\":\"notion user id\"},\"cover\":null,\"icon\":null,\"parent\":{\"type\":\"database_id\",\"database_id\":\"parent id\"},\"archived\":false,\"in_trash\":false,\"properties\":[{\"id\":\"Mnck\",\"type\":\"checkbox\",\"checkbox\":true,\"label\":\"Accueil\"},{\"id\":\"rUtu\",\"type\":\"rich_text\",\"rich_text\":[{\"type\":\"text\",\"text\":{\"content\":\"3\",\"link\":null},\"annotations\":{\"bold\":false,\"italic\":false,\"strikethrough\":false,\"underline\":false,\"code\":false,\"color\":\"default\"},\"plain_text\":\"3\",\"href\":null}],\"label\":\"Valeur\"},{\"id\":\"title\",\"type\":\"title\",\"title\":[{\"type\":\"text\",\"text\":{\"content\":\"Nb_conseils\",\"link\":null},\"annotations\":{\"bold\":false,\"italic\":false,\"strikethrough\":false,\"underline\":false,\"code\":false,\"color\":\"default\"},\"plain_text\":\"Nb_conseils\",\"href\":null}],\"label\":\"Identifiant\"}],\"url\":\"https://www.notion.so/Nb_conseils-somerandomstring\",\"public_url\":null,\"properties_value\":{\"Accueil\":true,\"Valeur\":[{\"type\":\"text\",\"text\":{\"content\":\"3\",\"link\":null},\"annotations\":{\"bold\":false,\"italic\":false,\"strikethrough\":false,\"underline\":false,\"code\":false,\"color\":\"default\"},\"plain_text\":\"3\",\"href\":null}],\"Identifiant\":[{\"type\":\"text\",\"text\":{\"content\":\"Nb_conseils\",\"link\":null},\"annotations\":{\"bold\":false,\"italic\":false,\"strikethrough\":false,\"underline\":false,\"code\":false,\"color\":\"default\"},\"plain_text\":\"Nb_conseils\",\"href\":null}]},\"__IMTLENGTH__\":2,\"__IMTINDEX__\":1},{\"object\":\"page\",\"id\":\"notion row id\",\"created_time\":\"2024-08-02T11:45:00.000Z\",\"last_edited_time\":\"2024-08-28T14:48:00.000Z\",\"created_by\":{\"object\":\"user\",\"id\":\"notion user id\"},\"last_edited_by\":{\"object\":\"user\",\"id\":\"notion user id\"},\"cover\":null,\"icon\":null,\"parent\":{\"type\":\"database_id\",\"database_id\":\"notion database id\"},\"archived\":false,\"in_trash\":false,\"properties\":[{\"id\":\"Mnck\",\"type\":\"checkbox\",\"checkbox\":true,\"label\":\"Accueil\"},{\"id\":\"rUtu\",\"type\":\"rich_text\",\"rich_text\":[{\"type\":\"text\",\"text\":{\"content\":\"Femmes actives et urbaines dans la trentaine.\",\"link\":null},\"annotations\":{\"bold\":false,\"italic\":false,\"strikethrough\":false,\"underline\":false,\"code\":false,\"color\":\"default\"},\"plain_text\":\"Femmes actives et urbaines dans la trentaine.\",\"href\":null}],\"label\":\"Valeur\"},{\"id\":\"title\",\"type\":\"title\",\"title\":[{\"type\":\"text\",\"text\":{\"content\":\"Cible\",\"link\":null},\"annotations\":{\"bold\":false,\"italic\":false,\"strikethrough\":false,\"underline\":false,\"code\":false,\"color\":\"default\"},\"plain_text\":\"Cible\",\"href\":null}],\"label\":\"Identifiant\"}],\"url\":\"https://www.notion.so/Cible-somerandomstring\",\"public_url\":null,\"properties_value\":{\"Accueil\":true,\"Valeur\":[{\"type\":\"text\",\"text\":{\"content\":\"Femmes actives et urbaines dans la trentaine.\",\"link\":null},\"annotations\":{\"bold\":false,\"italic\":false,\"strikethrough\":false,\"underline\":false,\"code\":false,\"color\":\"default\"},\"plain_text\":\"Femmes actives et urbaines dans la trentaine.\",\"href\":null}],\"Identifiant\":[{\"type\":\"text\",\"text\":{\"content\":\"Cible\",\"link\":null},\"annotations\":{\"bold\":false,\"italic\":false,\"strikethrough\":false,\"underline\":false,\"code\":false,\"color\":\"default\"},\"plain_text\":\"Cible\",\"href\":null}]},\"__IMTLENGTH__\":2,\"__IMTINDEX__\":2}]"},"metadata":{"designer":{"x":-53,"y":-1354,"name":"Notion Output"},"parameters":[{"name":"type","type":"udt","label":"Data structure"}]}},{"id":38,"module":"util:TextAggregator","version":1,"parameters":{"rowSeparator":"other","otherRowSeparator":",","feeder":37},"mapper":{"value":"{\n  \"Identifiant\": \"{{37.properties_value.Identifiant[].plain_text}}\",\n  \"Valeur\": \"{{37.properties_value.Valeur[].plain_text}}\"\n}"},"metadata":{"designer":{"x":190,"y":-1356},"parameters":[{"name":"rowSeparator","type":"select","label":"Row separator","validate":{"enum":["\n","\t","other"]}},{"name":"otherRowSeparator","type":"text","label":"Separator"}],"advanced":true}},{"id":39,"module":"json:ParseJSON","version":1,"parameters":{"type":""},"mapper":{"json":"{\"items\": [{{38.text}}]}"},"metadata":{"designer":{"x":434,"y":-1360},"parameters":[{"name":"type","type":"udt","label":"Data structure"}]}},{"id":40,"module":"util:SetVariable2","version":1,"parameters":{},"mapper":{"name":"properties","scope":"roundtrip","value":"{{toCollection(39.items; \"Identifiant\"; \"Valeur\")}}"},"metadata":{"designer":{"x":677,"y":-1364}}}]}],"metadata":{"version":1}}

Note: Did you know you can reduce the size of blueprints and module export code like the above, using the Make Blueprint Scrubber?

Hope this helps! Let me know if there are any further questions or issues.

@samliew


P.S.: Did you know, the concepts of about 70% of questions asked on this forum are already covered in the Make Academy. Investing some effort into it will save you lots of time and frustration using Make later!

Thank you so much ! It works ! :smiley:

And also for the trick of pasting the blueprint directly into the scenario. Simple but great tip !

:pray::pray::pray:

No problem, glad I could help!

1. If anyone has a new question in the future, please start a new thread. This makes it easier for others with the same problem to search for the answers to specific questions, and you are more likely to receive help since newer questions are monitored closely.

2. The Make Community guidelines encourages users to try to mark helpful replies as solutions to help keep the Community organized.

This marks the topic as solved, so that:

  • others can save time when catching up with the latest activity here, and
  • allows others to quickly jump to the solution if they come across the same problem

To do this, simply click the checkbox at the bottom of the post that answers your question:
Screenshot_2023-10-04_161049

3. Don’t forget to like and bookmark this topic so you can get back to it easily in future!

Hope this helps! Let me know if there are any further questions or issues.

@samliew


P.S.: Did you know, the concepts of about 70% of questions asked on this forum are already covered in the Make Academy. Investing some effort into it will save you lots of time and frustration using Make later!

1 Like