# Transform array

**URL:** <https://community.make.com/t/transform-array/49961>\
**Category:** Questions\
**Tags:** arrays\
**Created:** [August 7, 2024, 7:16pm UTC](https://community.make.com/t/transform-array/49961 "2024-08-07T19:16:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexander\_Hirsch](https://avatars.discourse-cdn.com/v4/letter/a/dc4da7/32.png) [@Alexander\_Hirsch](https://community.make.com/u/Alexander_Hirsch)\
**Post date:** [August 7, 2024, 7:16pm UTC](https://community.make.com/t/transform-array/49961/1 "2024-08-07T19:16:50Z")

</div>

When using the Notion module “get a database item” I get the array of collections “Properties”. The format is the following:

```auto
            {
                "id": "RjtT",
                "type": "url",
                "url": "http://xyz.com/",
                "label": "Contactpage"
            },
            {
                "id": "%5CW%5DY",
                "type": "phone_number",
                "phone_number": "+123456789",
                "label": "Mobile"
            },
            {
                "id": "al%3AW",
                "type": "multi_select",
                "multi_select": [],
                "label": "Responsible"
            },
            {
                "id": "hpFU",
                "type": "last_edited_time",
                "last_edited_time": "2024-08-07T17:53:00.000Z",
                "label": "Last change at"
            },

```

My goal is to retrieve a simple array in the form of

```auto
{
               "Contactpage": "http://xyz.com/",
               "Mobile": "+123456789",
               "Responsible": [],
               "Last change at": "2024-08-07T17:53:00.000Z"
}

```

I know this is supposed to work with the map() function, but the furthest I have gotten was to retrieve a list of all categories. Is there a way to do this dynamically without hardcoding the categories?

Thanks a lot in advance!

---

<div class="post-metadata">

**Author:** ![samliew](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/samliew/32/13327_2.png) [@samliew](https://community.make.com/u/samliew)\
**Post date:** [August 8, 2024, 1:14am UTC](https://community.make.com/t/transform-array/49961/2 "2024-08-08T01:14:42Z")

</div>

Yes. But first please provide the full output bundle so we can work with it.

Please provide the **output** bundles of the modules by running the scenario (or get from the [scenario History tab](https://www.make.com/en/help/scenarios/scenario-execution-history)), then click the white speech bubble on the top-right of each module and select “Download input/output bundles”.

 ![](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/2/8/2876156ab3ea5bc9e40bbc0edfb9f025406b7c48.png)

## A.

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

## B.

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

Here are two ways to format text so that it won’t be changed by the forum:

**A. Type code block manually**  
Add three backticks ````` before and after the content/bundle, like this:

> ```  
> _content goes here_  
> ```

**B. Highlight and click the format button in the editor**  
 ![](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/b/4/b485b6572c7a1c438f9b191c54e63d351008304c.png)

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.

Following these steps will allow others to assist you here. Thanks!

---

<div class="post-metadata">

**Author:** ![Alexander\_Hirsch](https://avatars.discourse-cdn.com/v4/letter/a/dc4da7/32.png) [@Alexander\_Hirsch](https://community.make.com/u/Alexander_Hirsch)\
**Post date:** [August 8, 2024, 1:00pm UTC](https://community.make.com/t/transform-array/49961/3 "2024-08-08T13:00:27Z")

</div>

Thank you for your answer! The output (with redacted values) is the following:

```auto
[
    {
        "object": "page",
        "id": "{ID}}",
        "created_time": "2024-08-07T16:49:00.000Z",
        "last_edited_time": "2024-08-07T17:53:00.000Z",
        "created_by": {
            "object": "user",
            "id": "{ID}}"
        },
        "last_edited_by": {
            "object": "user",
            "id": "{ID}}"
        },
        "cover": null,
        "icon": null,
        "parent": {
            "type": "database_id",
            "database_id": "{ID}}"
        },
        "archived": false,
        "in_trash": false,
        "properties": [
            {
                "id": "%3E%3ESP",
                "type": "date",
                "date": null,
                "label": "Datum"
            },
            {
                "id": "%3EV%3A%60",
                "type": "people",
                "people": [
                    {
                        "object": "user",
                        "id": "{ID}}",
                        "name": "Luke Test",
                        "avatar_url": "https://redacted.com/",
                        "type": "person",
                        "person": {
                            "email": "t.test@test.com"
                        }
                    }
                ],
                "label": "Verantwortlich"
            },
            {
                "id": "D%3CrZ",
                "type": "files",
                "files": [],
                "label": "Medien / Datein"
            },
            {
                "id": "N%5C%7Cj",
                "type": "url",
                "url": null,
                "label": "Links"
            },
            {
                "id": "RjtT",
                "type": "url",
                "url": null,
                "label": "Kontaktseite"
            },
            {
                "id": "%5CW%5DY",
                "type": "phone_number",
                "phone_number": "+4912345678912",
                "label": "Telefon"
            },
            {
                "id": "al%3AW",
                "type": "multi_select",
                "multi_select": [],
                "label": "Zugehörig"
            },
            {
                "id": "hpFU",
                "type": "last_edited_time",
                "last_edited_time": "2024-08-07T17:53:00.000Z",
                "label": "Letzte Änderung um"
            },
            {
                "id": "rS%3E_",
                "type": "email",
                "email": "t.test@test.com",
                "label": "E-Mail"
            },
            {
                "id": "%7BZ%5Eh",
                "type": "status",
                "status": {
                    "id": "{ID}}",
                    "name": "In Bearbeitung",
                    "color": "blue"
                },
                "label": "Status"
            },
            {
                "id": "%7Ch%7B%7C",
                "type": "created_time",
                "created_time": "2024-08-07T16:49:00.000Z",
                "label": "Erstellt um"
            },
            {
                "id": "title",
                "type": "title",
                "title": [
                    {
                        "type": "text",
                        "text": {
                            "content": "Tim Test",
                            "link": null
                        },
                        "annotations": {
                            "bold": false,
                            "italic": false,
                            "strikethrough": false,
                            "underline": false,
                            "code": false,
                            "color": "default"
                        },
                        "plain_text": "Tim Test",
                        "href": null
                    }
                ],
                "label": "Name"
            },
            {
                "id": "{ID}}",
                "type": "checkbox",
                "checkbox": false,
                "label": "Done"
            }
        ],
        "url": "https://www.notion.so/{ID}",
        "public_url": null,
        "request_id": "{ID}}",
        "properties_value": {
            "Datum": null,
            "Verantwortlich": [
                {
                    "object": "user",
                    "id": "{ID}}",
                    "name": "Luke Test",
                    "avatar_url": "https://redacted.com/",
                    "type": "person",
                    "person": {
                        "email": "t.test@test.com"
                    }
                }
            ],
            "Medien / Datein": [],
            "Links": null,
            "Kontaktseite": null,
            "Telefon": "+4912345678912",
            "Zugehörig": [],
            "Letzte Änderung um": "2024-08-07T17:53:00.000Z",
            "E-Mail": "t.test@test.com",
            "Status": {
                "id": "b118c21f-d642-4287-9976-3c2ad635227a",
                "name": "In Bearbeitung",
                "color": "blue"
            },
            "Erstellt um": "2024-08-07T16:49:00.000Z",
            "Name": [
                {
                    "type": "text",
                    "text": {
                        "content": "Tim Test",
                        "link": null
                    },
                    "annotations": {
                        "bold": false,
                        "italic": false,
                        "strikethrough": false,
                        "underline": false,
                        "code": false,
                        "color": "default"
                    },
                    "plain_text": "Tim Test",
                    "href": null
                }
            ],
            "Done": false
        }
    }
]

```

The solution is probably going to be some combination of map(), flatten() and slice(), but I just can’t seem to figure out how to do it

---

<div class="post-metadata">

**Author:** ![samliew](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/samliew/32/13327_2.png) [@samliew](https://community.make.com/u/samliew)\
**Post date:** [August 8, 2024, 2:21pm UTC](https://community.make.com/t/transform-array/49961/4 "2024-08-08T14:21:08Z")

</div>

Welcome to the Make community!

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

 ![Screenshot_2024-08-08_220816](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/1/7/17c67ba799c220b5c74e4ad4efadf618309be5ac.png)

## Example Output

 ![Screenshot_2024-08-08_220800](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/6/1/6164857a4a520b46c967373e5572090e5218f2db.png)

## Module Export

You can **copy** and **paste** this module export into your scenario. This will paste the modules shown in my screenshots above.

1. Copy the JSON code below by clicking the copy button when you mouseover the **top-right** of the code block  
 ![](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/2/b/2b1b692880388420db5045bf51ef344e6698a816.png)

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

3. Click on each imported module and save it for validation. You may be prompted to remap some variables and connections.

> **Click to Expand Module Export Code**
>
> **JSON** - Copy and Paste this directly in the scenario editor
> 
> ```json
> {
> "subflows": [
> {
> "flow": [
> {
> "id": 192,
> "module": "json:TransformToJSON",
> "version": 1,
> "parameters": {
> "space": ""
> },
> "mapper": {
> "object": "{{191.properties}}"
> },
> "metadata": {
> "designer": {
> "x": 2754,
> "y": -3587,
> "name": "Transform Properties to JSON"
> },
> "restore": {
> "parameters": {
> "space": {
> "label": "Empty"
> }
> }
> },
> "parameters": [
> {
> "name": "space",
> "type": "select",
> "label": "Indentation",
> "validate": {
> "enum": [
> "tab",
> "2",
> "4"
> ]
> }
> }
> ],
> "expect": [
> {
> "name": "object",
> "type": "any",
> "label": "Object"
> }
> ]
> }
> },
> {
> "id": 193,
> "module": "regexp:Parser",
> "version": 1,
> "parameters": {
> "pattern": "{\"id\":\"[^\"]+\",\"type\":\"[^\"]+\",\"[^\"]+\":\"?(?<value>.+?)\"?,\"label\":\"(?<key>[^\"]+?)\"}",
> "global": true,
> "sensitive": true,
> "multiline": false,
> "singleline": false,
> "continueWhenNoRes": false,
> "ignoreInfiniteLoopsWhenGlobal": false
> },
> "mapper": {
> "text": "{{192.json}}"
> },
> "metadata": {
> "designer": {
> "x": 2999,
> "y": -3587,
> "name": "Match KVPs"
> },
> "restore": {
> "parameters": {
> "multiline": {
> "collapsed": true
> },
> "singleline": {
> "collapsed": true
> },
> "continueWhenNoRes": {
> "collapsed": true
> }
> }
> },
> "parameters": [
> {
> "name": "pattern",
> "type": "text",
> "label": "Pattern",
> "required": true
> },
> {
> "name": "global",
> "type": "boolean",
> "label": "Global match",
> "required": true
> },
> {
> "name": "sensitive",
> "type": "boolean",
> "label": "Case sensitive",
> "required": true
> },
> {
> "name": "multiline",
> "type": "boolean",
> "label": "Multiline",
> "required": true
> },
> {
> "name": "singleline",
> "type": "boolean",
> "label": "Singleline",
> "required": true
> },
> {
> "name": "continueWhenNoRes",
> "type": "boolean",
> "label": "Continue the execution of the route even if the module finds no matches",
> "required": true
> },
> {
> "name": "ignoreInfiniteLoopsWhenGlobal",
> "type": "boolean",
> "label": "Ignore errors when there is an infinite search loop",
> "required": true
> }
> ],
> "expect": [
> {
> "name": "text",
> "type": "text",
> "label": "Text"
> }
> ],
> "interface": [
> {
> "type": "text",
> "name": "value",
> "label": "value"
> },
> {
> "type": "text",
> "name": "key",
> "label": "key"
> },
> {
> "type": "uinteger",
> "name": "i",
> "label": "i"
> },
> {
> "type": "any",
> "name": " __IMTMATCH__",
> "label": "Fallback Match"
> }
> ]
> }
> },
> {
> "id": 194,
> "module": "builtin:BasicAggregator",
> "version": 1,
> "parameters": {
> "feeder": 193
> },
> "mapper": {
> "value": "{{193.value}}",
> "key": "{{193.key}}"
> },
> "metadata": {
> "designer": {
> "x": 3243,
> "y": -3589
> },
> "restore": {
> "extra": {
> "feeder": {
> "label": "Text parser - Match pattern [193]"
> },
> "target": {
> "label": "Custom"
> }
> }
> }
> }
> },
> {
> "id": 195,
> "module": "util:SetVariable2",
> "version": 1,
> "parameters": {},
> "mapper": {
> "name": "object",
> "scope": "roundtrip",
> "value": "{{toCollection(194.array; \"key\"; \"value\")}}"
> },
> "metadata": {
> "designer": {
> "x": 3485,
> "y": -3592,
> "name": "Convert to Collection"
> },
> "restore": {
> "expect": {
> "scope": {
> "label": "One cycle"
> }
> }
> },
> "expect": [
> {
> "name": "name",
> "type": "text",
> "label": "Variable name",
> "required": true
> },
> {
> "name": "scope",
> "type": "select",
> "label": "Variable lifetime",
> "required": true,
> "validate": {
> "enum": [
> "roundtrip",
> "execution"
> ]
> }
> },
> {
> "name": "value",
> "type": "any",
> "label": "Variable value"
> }
> ],
> "interface": [
> {
> "name": "object",
> "label": "object",
> "type": "any"
> }
> ]
> }
> }
> ]
> }
> ],
> "metadata": {
> "version": 1
> }
> }
> 
> ```

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

— @samliew

---

<div class="post-metadata">

**Author:** ![Alexander\_Hirsch](https://avatars.discourse-cdn.com/v4/letter/a/dc4da7/32.png) [@Alexander\_Hirsch](https://community.make.com/u/Alexander_Hirsch)\
**Post date:** [August 8, 2024, 2:26pm UTC](https://community.make.com/t/transform-array/49961/5 "2024-08-08T14:26:22Z")

</div>

I am extremely impressed by the extremely fast solution!! THANK YOU a ton!

---

<div class="post-metadata">

**Author:** ![Make\_Bot](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/make_bot/32/14661_2.png) [@Make\_Bot](https://community.make.com/u/Make_Bot)\
**Post date:** [August 22, 2024, 2:34pm UTC](https://community.make.com/t/transform-array/49961/6 "2024-08-22T14:34:03Z")

</div>

This topic was automatically closed because it's resolved or inactive. Please, start a new topic.


