# Adding multiple items with the same header for an API Post

**URL:** <https://community.parabola.io/t/adding-multiple-items-with-the-same-header-for-an-api-post/1017>\
**Category:** Ask a question\
**Created:** [September 1, 2020, 10:33pm UTC](https://community.parabola.io/t/adding-multiple-items-with-the-same-header-for-an-api-post/1017 "2020-09-01T22:33:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Annika\_Cederblad](https://avatars.discourse-cdn.com/v4/letter/a/a88e57/32.png) [@Annika\_Cederblad](https://community.parabola.io/u/Annika_Cederblad)\
**Post date:** [September 1, 2020, 10:33pm UTC](https://community.parabola.io/t/adding-multiple-items-with-the-same-header-for-an-api-post/1017/1 "2020-09-01T22:33:30Z")

</div>

I am trying to pull orders from one system and post them in a different system using their respective APIs. Each order has a header (with the order number, date, customer, etc) and at least one item, but it could have an infinite number of items.

I have flattened and expanded the JSON that was pulled out of the first system so that the individual line items for each order have their own row and a column for each data point. I have two tables: one with the header information and a second with all the line item rows.

I would now like to put the order header and all of its line items back into a single json body to create the orders in the second system. How can I achieve this? See example below. I would love recommendations for the entire workflow but am most curious about how I can both merge the values in table two based on their Order No field while also indicating what the JSON format should be.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/parabola/original/1X/d0c79032ecc8dae628f676ece3b219faedec58ac.png)

---

<div class="post-metadata">

**Author:** ![sachi](https://sea2.discourse-cdn.com/flex020/user_avatar/community.parabola.io/sachi/32/10_2.png) [@sachi](https://community.parabola.io/u/sachi)\
**Post date:** [September 2, 2020, 12:32am UTC](https://community.parabola.io/t/adding-multiple-items-with-the-same-header-for-an-api-post/1017/2 "2020-09-02T00:32:12Z")

</div>

Hey @Annika_Cederblad - In general, when needing to create JSON bodies like this, we use a combination of the `Insert Column` step and the `Merge Values` step. I took your dummy data and made this sample flow to show you the steps you’ll need:

 ![Screen Shot 2020-09-01 at 5.26.55 PM](https://us1.discourse-cdn.com/flex020/uploads/parabola/original/1X/2ad7f48fdf09009186c7396ee083794681858cb4.png)

In my flow, the `Pull from Google Sheets` step is your Table 1 and `Pull from Google Sheets (1)` is your Table 2.

First, I take the Table 2 data and create a new column using the `Insert Column` step:

 ![Screen Shot 2020-09-01 at 5.28.10 PM](https://us1.discourse-cdn.com/flex020/uploads/parabola/original/1X/e2aa4de91496fecafd8b54b624225389cd617031.png)

Then, I use the `Merge Values` step to merge my items into a single cell per Order No.

 ![Screen Shot 2020-09-01 at 5.28.47 PM](https://us1.discourse-cdn.com/flex020/uploads/parabola/original/1X/1e1cd022c1aeb8bfe7a0a0f5f57100128b475929.png)

Next, I use the `Combine Tables` step to combine Table 1 and Table 2 together using Order No. as the matching criteria.

Lastly, I use another `Insert Column` step to create my JSON column:

 ![Screen Shot 2020-09-01 at 5.29.50 PM](https://us1.discourse-cdn.com/flex020/uploads/parabola/original/1X/985e5d1b97a938b6ec2a4a5365c1e6eefc39bb88.png)

My output looks like this:  
`{"Order No":"1000","Date":"8/1/2020","Customer":"Paul","Line Item":[{"Item":"Orange","Price":2.00,"Quantity":5,"Subtotal":10.00}]} `

`{"Order No":"1001","Date":"8/1/2020","Customer":"John","Line Item":[{"Item":"Orange","Price":2.00,"Quantity":10,"Subtotal":20.00} , {"Item":"Apple","Price":1.00,"Quantity":2,"Subtotal":2.00} , {"Item":"Banana","Price":0.50,"Quantity":9,"Subtotal":4.50}]}`

Hope that helps!
