# Arrays in json - how to create them

**URL:** <https://community.glideapps.com/t/arrays-in-json-how-to-create-them/73985>\
**Category:** Ask for Help\
**Created:** [June 8, 2024, 9:15pm UTC](https://community.glideapps.com/t/arrays-in-json-how-to-create-them/73985 "2024-06-08T21:15:47Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Krivo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/krivo/32/5363_2.png) [@Krivo](https://community.glideapps.com/u/Krivo)\
**Post date:** [June 8, 2024, 9:15pm UTC](https://community.glideapps.com/t/arrays-in-json-how-to-create-them/73985/1 "2024-06-08T21:15:47Z")

</div>

I have a table with order items and a table with orders

The order items table have the columns order, name and numbers

I need to create a json like below.

I find it hard to create the array using JSON columns - but maybe it isn’t actually possible?

I can create a relation (match multiple) to get all the orderItems - and I lookup a json objects like  
{  
“name”:“gear”,  
“numbers”: 3  
}

The lookup’ed column (the above json object) is then transformed by a joined list  
Then a template column to add square brackets around the joined list

It seems like when I go down the template column road then json data columns cannot be used to create the final json.

I have tried different ways which can be seen in this demo app:

> **[Tester](https://json-test.glide.page/)**

(FinalJsonNotWorking1, FinalJsonNotWorking2 - yeah, they are not working)

Is there a way to get the json created _without_ using template column - and just using JSON columns.

**Final json**  
{  
“company”: “MyCompany”,  
“order”: 1010,  
“orderItems”:[  
{  
“name”:“gear”,  
“numbers”: 3  
},  
{  
“name”:“wheel”,  
“numbers”: 2  
}  
]  
}

**FinalJsonNotWorking2**  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/2/6/2698fb04469145003e36c094912425b7062132af.png)

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/e/6/e652915add2e538916f309466451cd9d63173699.png)

---

<div class="post-metadata">

**Author:** ![Sekayi\_Liburd](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/sekayi_liburd/32/77608_2.png) [@Sekayi\_Liburd](https://community.glideapps.com/u/Sekayi_Liburd)\
**Post date:** [June 8, 2024, 9:49pm UTC](https://community.glideapps.com/t/arrays-in-json-how-to-create-them/73985/2 "2024-06-08T21:49:08Z")

</div>

I haven’t tried it myself but did you do it the same way as in this video?

> [@dizzyaccordion JSON Trebuchet](https://community.glideapps.com/t/json-trebuchet/72744):
>
> wave Hey fellow Gliders! Part two of my Trebuchet series is live! Last week, I posted a tutorial on a new way to create inline arrays using the Trebuchet method Part 2 is a deep dive on how you can Trebuchet more than a single value by creating arrays of JSON exploding_head. Check out how to build an inventory ordering app using the JSON Trebuchet Method! :popcorn:Enjoy! [[Glide: Build an Inventory Ordering App Using the JSON Trebuchet Method] ](https://www.youtube.com/watch?v=1QbKTccN850)

---

<div class="post-metadata">

**Author:** ![Krivo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/krivo/32/5363_2.png) [@Krivo](https://community.glideapps.com/u/Krivo)\
**Post date:** [June 8, 2024, 9:54pm UTC](https://community.glideapps.com/t/arrays-in-json-how-to-create-them/73985/3 "2024-06-08T21:54:10Z")

</div>

I would definitely have a look. Thx

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [June 9, 2024, 2:05am UTC](https://community.glideapps.com/t/arrays-in-json-how-to-create-them/73985/4 "2024-06-09T02:05:59Z")

</div>

You can try pointing the orderItems variable straight at the lookup, instead of doing this.

> [@Krivo](#):
>
> The lookup’ed column (the above json object) is then transformed by a joined list  
> Then a template column to add square brackets around the joined list

---

<div class="post-metadata">

**Author:** ![Krivo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/krivo/32/5363_2.png) [@Krivo](https://community.glideapps.com/u/Krivo)\
**Post date:** [June 9, 2024, 6:47am UTC](https://community.glideapps.com/t/arrays-in-json-how-to-create-them/73985/5 "2024-06-09T06:47:47Z")

</div>

@ThinhDinh Well your suggestion worked! Cool.  
So you just need to have an array of values (like from a multiple relation). Good to know

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/e/e/ee34bc4b5b90847ae122dd5e4ea14df3c15fb6d0.png)

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/2/0/204f619d17eb0cfa2cfbd5653965162d1222ef6a.png)

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [June 9, 2024, 10:07am UTC](https://community.glideapps.com/t/arrays-in-json-how-to-create-them/73985/6 "2024-06-09T10:07:06Z")

</div>

Yeah, that’s what they rolled out a while ago and it’s much easier than creating template columns 😉

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)\
**Post date:** [June 16, 2024, 10:07am UTC](https://community.glideapps.com/t/arrays-in-json-how-to-create-them/73985/7 "2024-06-16T10:07:20Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
