# Converting collection in array into plain text

**URL:** <https://community.make.com/t/converting-collection-in-array-into-plain-text/33935>\
**Category:** Questions\
**Tags:** arrays\
**Created:** [April 16, 2024, 6:57am UTC](https://community.make.com/t/converting-collection-in-array-into-plain-text/33935 "2024-04-16T06:57:05Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cyau1983](https://avatars.discourse-cdn.com/v4/letter/c/ea666f/32.png) [@Cyau1983](https://community.make.com/u/Cyau1983)\
**Post date:** [April 16, 2024, 6:57am UTC](https://community.make.com/t/converting-collection-in-array-into-plain-text/33935/1 "2024-04-16T06:57:05Z")

</div>

Dear all,

I have this collection as part of an array.

“Nutritional value”: {  
“Carbohydrates”: “35 g”,  
“Protein”: “24 g”,  
“Total Fat”: “12 g”,  
“Saturated Fat”: “4 g”,  
“Trans Fat”: “0 g”,  
“Monounsaturated Fat”: “5 g”,  
“Polyunsaturated Fat”: “2 g”,  
“Cholesterol”: “90 mg”,  
“Sodium”: “950 mg”,  
“Dietary Fiber”: “2 g”,  
“Sugar”: “12 g”,  
“Calcium”: “40 mg”,  
“Potassium”: “399 mg”,  
“Iron”: “2.1 mg”,  
“Vitamin A”: “35 µg”,  
“Vitamin C”: “1 mg”  
},

I have been searching the entire forum for solution to converting this collection into a plain text, but can’t find it.

It should just simply convert into something like this below, which I can reuse in a Chatgpt prompt or some other module downstream.

Per Serving in Calories: 350 kcal  
Carbohydrates: 35 g  
etc. etc

Appreciate any kind of help

---

<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:** [April 16, 2024, 7:01am UTC](https://community.make.com/t/converting-collection-in-array-into-plain-text/33935/2 "2024-04-16T07:01:13Z")

</div>

You can use the module Tools \> “Compose a string”, and you can map the variables into there in the format that you want.

 ![Screenshot_2024-04-16_150425](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/d/2/d272024bb9136324c9351e83f84b0b39718099bf.png)

---

<div class="post-metadata">

**Author:** ![Cyau1983](https://avatars.discourse-cdn.com/v4/letter/c/ea666f/32.png) [@Cyau1983](https://community.make.com/u/Cyau1983)\
**Post date:** [April 16, 2024, 7:10am UTC](https://community.make.com/t/converting-collection-in-array-into-plain-text/33935/3 "2024-04-16T07:10:09Z")

</div>

thanks so much for the quick reply.

The only problem is…  
I don’t know what these components will be as I am getting it from GPT, so sometimes it’s more, and sometimes it’s less… hence It’s important that the varaibles and the keys are all just output from the array… Appreciate your help.

---

<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:** [April 16, 2024, 8:12am UTC](https://community.make.com/t/converting-collection-in-array-into-plain-text/33935/4 "2024-04-16T08:12:15Z")

</div>

In that case you’ll need a minimum of two modules:

 ![Screenshot_2024-04-16_160445](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/4/3/43c2f642848d5cccf610a55d3d92c4e9a8dd8a5d.png)

 ![Screenshot_2024-04-16_160413](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/8/c/8c6faee9ee4168620a61b3cae0ab0d405c3ad960.png)

 ![Screenshot_2024-04-16_160444](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/3/7/37ac48fcdf3573dda253f854df08a468f70161db.png)

```plaintext
 {{114.key}}: {{114.value.value}}

```

Give it a go and let us know if you have any issues!

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

1. Copy the code below by clicking the copy button when you mouseover the **top-right** of the code block  
 ![Screenshot_2024-01-17_200117](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 to paste in the canvas.

3. Click on each imported module and save it. You may need to remap some variables.

### Modules JSON Export

```json
{
    "subflows": [
        {
            "flow": [
                {
                    "id": 114,
                    "module": "builtin:BasicFeeder",
                    "version": 1,
                    "parameters": {},
                    "mapper": {
                        "array": "{{toArray(112.`Nutritional value`)}}"
                    },
                    "metadata": {
                        "designer": {
                            "x": -569,
                            "y": -2983
                        },
                        "restore": {
                            "expect": {
                                "array": {
                                    "mode": "edit"
                                }
                            }
                        },
                        "expect": [
                            {
                                "name": "array",
                                "type": "array",
                                "label": "Array",
                                "mode": "edit",
                                "spec": []
                            }
                        ]
                    }
                },
                {
                    "id": 115,
                    "module": "util:TextAggregator",
                    "version": 1,
                    "parameters": {
                        "rowSeparator": "\n",
                        "feeder": 114
                    },
                    "mapper": {
                        "value": " {{114.key}}: {{114.value.value}}"
                    },
                    "metadata": {
                        "designer": {
                            "x": -323,
                            "y": -2983,
                            "messages": [
                                {
                                    "category": "last",
                                    "severity": "warning",
                                    "message": "A transformer should not be the last module in the route."
                                }
                            ]
                        },
                        "restore": {
                            "parameters": {
                                "rowSeparator": {
                                    "label": "New row"
                                }
                            },
                            "extra": {
                                "feeder": {
                                    "label": "Iterator [114]"
                                }
                            },
                            "flags": {
                                "groupBy": {
                                    "collapsed": true
                                },
                                "stopIfEmpty": {
                                    "collapsed": true
                                }
                            }
                        },
                        "parameters": [
                            {
                                "name": "rowSeparator",
                                "type": "select",
                                "label": "Row separator",
                                "validate": {
                                    "enum": [
                                        "\n",
                                        "\t",
                                        "other"
                                    ]
                                }
                            }
                        ],
                        "expect": [
                            {
                                "name": "value",
                                "type": "text",
                                "label": "Text"
                            }
                        ],
                        "advanced": true
                    }
                }
            ]
        }
    ],
    "metadata": {
        "version": 1
    }
}

```

---

<div class="post-metadata">

**Author:** ![Cyau1983](https://avatars.discourse-cdn.com/v4/letter/c/ea666f/32.png) [@Cyau1983](https://community.make.com/u/Cyau1983)\
**Post date:** [April 16, 2024, 10:28am UTC](https://community.make.com/t/converting-collection-in-array-into-plain-text/33935/5 "2024-04-16T10:28:57Z")

</div>

It worked 🙂 Thank you so much.

---

<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:** [April 16, 2024, 12:00pm UTC](https://community.make.com/t/converting-collection-in-array-into-plain-text/33935/6 "2024-04-16T12:00:49Z")

</div>

No problem, glad I could help!

1. If you have 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](https://community.make.com/t/make-community-the-ultimate-topic/11682) 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](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/5/d/5d9b26fbef0fd7385a34084f61cd5b9165786f42.png)

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

## Links

Here are some useful links and guides you can use to learn more on how to use the Make platform, apps, and app modules. I found these useful when I was learning Make, and hope they might benefit you too —

### General

- [Help Center](https://www.make.com/en/help) | [Tutorials](https://www.make.com/en/help/tutorials.html)
- [Make Academy](https://academy.make.com) – learn Make and get your certificate **← CHECK THIS OUT**
- [Make Blog](https://www.make.com/en/blog) – get the latest updates
- [Features & Pricing](https://www.make.com/en/pricing)

### Help Center Basics

- [Mapping](https://www.make.com/en/help/mapping/mapping) – What is mapping? What can I map?
- [Mapping with arrays](https://www.make.com/en/help/mapping/mapping-arrays) – How to map items in an array
- [Aggregate an array for mapping complex fields](https://www.make.com/en/help/tools/flow-control#customizing-the-output)
- [Tokens for `parseDate`](https://www.make.com/en/help/functions/tokens-for-date-time-parsing) | [Tokens for `formatDate`](https://www.make.com/en/help/functions/tokens-for-date-time-formatting)
- [HTTP modules](https://www.make.com/en/help/tools/http) – Make a request, Get (download) a file
- [Webhooks](https://www.make.com/en/help/tools/webhooks) – Error Handling, Responding to webhooks

### Articles & Videos

- [Router Magic Formula](https://www.youtube.com/watch?v=4Q-5BsCtJu4) - YouTube
- [Error Handlers in Make](https://www.youtube.com/playlist?list=PLRE9E-rAD8U10mx2TRs54Nq1XJDdK9Kx4) - YouTube playlist
- [Getting started with OpenAI](https://community.make.com/t/getting-started-with-openai-gpt-3-and-make/7796)
- [How to use Regex in Make](https://community.make.com/t/how-to-use-regex-in-make/202)

---

<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:** [April 30, 2024, 3:04pm UTC](https://community.make.com/t/converting-collection-in-array-into-plain-text/33935/7 "2024-04-30T15:04:02Z")

</div>


