# Mapping An Array To A Field

**URL:** <https://community.make.com/t/mapping-an-array-to-a-field/27334>\
**Category:** Questions\
**Tags:** arrays, error, mapping\
**Created:** [February 13, 2024, 4:59pm UTC](https://community.make.com/t/mapping-an-array-to-a-field/27334 "2024-02-13T16:59:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexs](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/alexs/32/23635_2.png) [@alexs](https://community.make.com/u/alexs)\
**Post date:** [February 13, 2024, 4:59pm UTC](https://community.make.com/t/mapping-an-array-to-a-field/27334/1 "2024-02-13T16:59:40Z")

</div>

I’m creating a PandaDoc document via their API. Their Postman collection includes an [example](https://www.postman.com/pandadoc-api/workspace/pandadoc-s-public-workspace/request/13640781-a21534b6-3a36-43fc-ba2b-ac98d1b82097?tab=body) of the content that needs to be included in the API request but I’m using Make’s in-built module for this.

I need to populate the rows in a pricing table based on the contents of pages from Notion. So I want to create the rows using an Aggregate To JSON step -

 ![CleanShot 2024-02-13 at 16.53.41@2x](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/b/5/b5157fe47badcf7daef9cf2278ca5bdddad4e90e.png)

and then I’m mapping the JSON like -

 ![CleanShot 2024-02-13 at 16.55.15@2x](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/d/4/d43ed6f2dfb8317dfb73e8f11f2e41c143997fd0.png)

The output of the Aggregate To JSON step is an array of objects. Except apparently it isn’t because when I made the request, I get an error -

> ##### BundleValidationError
> 
> Validation failed for 1 parameter(s).
> 
> - Array of objects expected in parameter ‘rows’.

I’ve tried parsing the JSON string into an object with {“rows”: JSON string} but when I map that, PandaDoc thinks that the required fields are missing, presumably because I’ve added a rows object to the rows field that’s already included in the form.

If I have an array of objects in a JSON string, how can I map that to the field in form so that it’s recognised correctly?

Sample JSON from the aggregate to JSON step -

```auto
[
    {
        "data": {
            "QTY": 1,
            "Tax": {
                "type": null,
                "value": null
            },
            "Name": "Airplane Ticket",
            "Price": 300,
            "Description": null
        },
        "options": {
            "optional": false,
            "qty_editable": false,
            "optional_selected": false
        }
    },
    {
        "data": {
            "QTY": 2,
            "Tax": {
                "type": null,
                "value": null
            },
            "Name": "Designer 2 Days",
            "Price": 600,
            "Description": null
        },
        "options": {
            "optional": false,
            "qty_editable": false,
            "optional_selected": false
        }
    }
]

```

Note: I’m not including a blueprint here because setting up the automation without the Notion databases &/or a PandaDoc account wouldn’t work.

---

<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:** [February 13, 2024, 10:42pm UTC](https://community.make.com/t/mapping-an-array-to-a-field/27334/2 "2024-02-13T22:42:53Z")

</div>

You should have used an array aggregator instead, because the field is expecting an **ARRAY**.

You use a JSON aggregator only if it expects a **STRING**.

Every result (item/record) from a search/match module will output a bundle. To “combine” them into a single structure, you’ll need to use an aggregator of some sort.

[Aggregators](https://www.make.com/en/help/modules/aggregator.html) are modules that accumulate multiple bundles into one single bundle. An example of a commonly-used aggregator module is the [Array aggregator](https://www.make.com/en/help/tools/flow-control.html#array-aggregator) module.

The Array Aggregator module also allows you to **build a complex array of collections for a later module’s field** to map multiple items (collections) to it.

Here is an example of using the “Target structure type” of an Array Aggregator module:

 ![Screenshot_2024-01-17_100113](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/b/e/bea4ecffec9daf39ca9cba77c0b2a40d160e7292.png)

As you can see, the “Map” toggle on fields are used when you have an array. You can easily build an array variable to map to a field, by using an Array Aggregator module and select the “Target Structure Type” as the future field you want to map the array into.

---

<div class="post-metadata">

**Author:** ![alexs](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/alexs/32/23635_2.png) [@alexs](https://community.make.com/u/alexs)\
**Post date:** [February 14, 2024, 8:55am UTC](https://community.make.com/t/mapping-an-array-to-a-field/27334/3 "2024-02-14T08:55:08Z")

</div>

Got it, thanks for the pointers!

> [@samliew](#):
>
> The Array Aggregator module also allows you to **build a complex array of collections for a later module’s field** to map multiple items (collections) to it.
> 
> Here is an example of using the “Target structure type” of an Array Aggregator module:

This works really well -

 ![CleanShot 2024-02-14 at 08.53.13@2x](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/5/2/52e6fcad4e4ad45aea65c1600ad47a1e6361c894.png) ![CleanShot 2024-02-14 at 08.54.44@2x](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/2/f/2f3ab46b1012fe85daa8668249beb12f86b73e81.png)

---

<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 28, 2024, 9:02am UTC](https://community.make.com/t/mapping-an-array-to-a-field/27334/4 "2024-02-28T09:02:11Z")

</div>


