# How to aggregate array into JSON?

**URL:** <https://community.make.com/t/how-to-aggregate-array-into-json/58737>\
**Category:** Questions\
**Tags:** arrays, json\
**Created:** [October 24, 2024, 9:05am UTC](https://community.make.com/t/how-to-aggregate-array-into-json/58737 "2024-10-24T09:05:32Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lucas3](https://avatars.discourse-cdn.com/v4/letter/l/278dde/32.png) [@Lucas3](https://community.make.com/u/Lucas3)\
**Post date:** [October 24, 2024, 9:05am UTC](https://community.make.com/t/how-to-aggregate-array-into-json/58737/1 "2024-10-24T09:05:32Z")

</div>

Hello,

I am struggling with bundles and arrays.

In my scenario, I get data about an item (Booking) via an API request , then I iterate through sub item (fees) that I got as an output. I then aggregate the output of each of this sub item.

What I want is get a single output with all the object into a json object that I can add to my DB in the next steps.

Here is my iterator :

 ![Screenshot 2024-10-24 at 10.59.48](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/8/1/8143a5d4323e70dfd74e514c8c589dd6cab079a7.jpeg)

The aggregator :

 ![Screenshot 2024-10-24 at 11.00.10](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/9/5/95103bb19ee5aca02031627c76123c1a90e2db3e.jpeg)

At first I used the array data from the aggregator (in the module to add data to my DB), got this error :

 ![Screenshot 2024-10-24 at 11.00.37](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/6/0/60f8b642a02b7fb0be703863381827d2846f047a.png)  
 ![Screenshot 2024-10-24 at 11.02.11](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/0/d/0db0eb0bbb36f072eab628d8e41538a388c1e7fc.png)

When using the Array (not the array data) I don’t have mistakes but I end up with this value in my DB `[Collection]`.

Ideally I would want a json object as an array :

```auto
[
  {
    "booking_fees": {
      "name": {
        "en": "$value"
      },
      "price": "$value"
    }
  },
  {
    "booking_fees": {
      "name": {
        "en": "$value"
      },
      "price": "$value"
    }
  },
  {
    "booking_fees": {
      "name": {
        "en": "$value"
      },
      "price": "$value"
    }
  }
]

Thanks in advance for the 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:** [October 25, 2024, 6:34am UTC](https://community.make.com/t/how-to-aggregate-array-into-json/58737/2 "2024-10-25T06:34:34Z")

</div>

You can either use the JSON “Aggregate to JSON” module, or a text aggregator.

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

— @samliew

* * *

P.S.: Did you know, [the concepts](https://community.make.com/t/make-academy-course-overview/29699) of about 70% of questions asked on this forum are already covered in the [Make Academy](https://academy.make.com). Investing some effort into it will save you lots of time and frustration using Make later!

---

<div class="post-metadata">

**Author:** ![Lucas3](https://avatars.discourse-cdn.com/v4/letter/l/278dde/32.png) [@Lucas3](https://community.make.com/u/Lucas3)\
**Post date:** [October 29, 2024, 10:14am UTC](https://community.make.com/t/how-to-aggregate-array-into-json/58737/3 "2024-10-29T10:14:41Z")

</div>

Thanks @samliew

I tried the text aggregator, I don’t have the error anymore, but the output I have from the text aggregator here this :

`[Collection], [Collection], [Collection], [Collection], [Collection]`

Here is how I set up the array aggregator and text aggregator 🙂

 ![Screenshot 2024-10-29 at 11.09.33](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/f/e/fea6956db29dc97ee5ed47066a8a9188f7cd7ac9.png)

 ![Screenshot 2024-10-29 at 11.09.29](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/f/f/ff2c21e6a9e97a5fd788da5b17f3923d49ce3da5.png)

---

<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:** [October 29, 2024, 12:11pm UTC](https://community.make.com/t/how-to-aggregate-array-into-json/58737/4 "2024-10-29T12:11:49Z")

</div>

You actually have to type out each “object” in the Text Aggregator.

```plaintext
{
    "booking_fees": {
      "name": {
        "en": "$value"
      },
      "price": "$value"
    }
  }

```

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

— @samliew

P.S.: Investing some effort into the [Make Academy](https://academy.make.com) will save you lots of time and frustration using Make.

---

<div class="post-metadata">

**Author:** ![Lucas3](https://avatars.discourse-cdn.com/v4/letter/l/278dde/32.png) [@Lucas3](https://community.make.com/u/Lucas3)\
**Post date:** [October 29, 2024, 2:08pm UTC](https://community.make.com/t/how-to-aggregate-array-into-json/58737/5 "2024-10-29T14:08:56Z")

</div>

@samliew I tried hat you suggested and it’s in progress !

But in my text aggregator output I only have one object, the first one, whereas I had 2 bundle out of the aggregator.

Here is what I did :

 ![Screenshot 2024-10-29 at 14.56.07](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/4/7/47974e752becc781eb784f1deb04935f2105c645.png)  
 ![Screenshot 2024-10-29 at 14.55.57](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/e/a/ea8ac3d51e77c89cfba305245e64bd2ed00ae6cb.png)

whereas I have as we can see 2 bundles :

 ![Screenshot 2024-10-29 at 15.08.45](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/0/a/0a69fc0bec74a8052c5033142fda19e383ff0b2c.jpeg)

---

<div class="post-metadata">

**Author:** ![Lucas3](https://avatars.discourse-cdn.com/v4/letter/l/278dde/32.png) [@Lucas3](https://community.make.com/u/Lucas3)\
**Post date:** [November 26, 2024, 8:13am UTC](https://community.make.com/t/how-to-aggregate-array-into-json/58737/6 "2024-11-26T08:13:37Z")

</div>

Hello @samliew

I couldn’t fix it, I tried with text aggregator, JSON module but in vain. I did a loom to showcase my issue, if you have time to watch it would be kind of you.

Thanks in advance  
Lucas

---

<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:** [February 24, 2025, 8:16am UTC](https://community.make.com/t/how-to-aggregate-array-into-json/58737/7 "2025-02-24T08:16:43Z")

</div>

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


