# Turn JSON array into rows in separate table

**URL:** <https://community.glideapps.com/t/turn-json-array-into-rows-in-separate-table/83153>\
**Category:** Ask for Help\
**Created:** [July 13, 2025, 10:32pm UTC](https://community.glideapps.com/t/turn-json-array-into-rows-in-separate-table/83153 "2025-07-13T22:32:10Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![blairrorani](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/blairrorani/32/43426_2.png) [@blairrorani](https://community.glideapps.com/u/blairrorani)\
**Post date:** [July 13, 2025, 10:32pm UTC](https://community.glideapps.com/t/turn-json-array-into-rows-in-separate-table/83153/1 "2025-07-13T22:32:10Z")

</div>

I’m hoping to get the latest and greatest solution to a common challenge:  
Turning a JSON array into rows in a separate table.

[Here’s one of the simplest looking solutions I found.](https://community.glideapps.com/t/is-it-possible-to-split-individual-elements-of-json-query-into-separate-rows-in-different-table/77898)

Wondering if there are any others?

I want to get a list of services for a client from a data source and then add them to a services\_list table in Glide (separate to the table where I store the json).

Purpose is to allow user to select services associated with that client from a choice component. So I need to add rows for many clients to same table over time and will use a unique id for each client so I can filter them for my choice component.

All help appreciated 🙌

---

<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:** [July 13, 2025, 11:54pm UTC](https://community.glideapps.com/t/turn-json-array-into-rows-in-separate-table/83153/2 "2025-07-13T23:54:58Z")

</div>

A not-very-cost-effective way imo is sending them to a webhook workflow, loop through the JSON, parse each field out using query JSON and finally add a row.

A better way but more complex is using either JSONata or JavaScript to turn your JSON into something that fits with the Glide API, and then send an API call to batch add multiple rows to the destination table.

---

<div class="post-metadata">

**Author:** ![blairrorani](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/blairrorani/32/43426_2.png) [@blairrorani](https://community.glideapps.com/u/blairrorani)\
**Post date:** [July 14, 2025, 9:50pm UTC](https://community.glideapps.com/t/turn-json-array-into-rows-in-separate-table/83153/3 "2025-07-14T21:50:15Z")

</div>

So:

1. Get JSON and store in column
2. Transform JSON (into ?? format)
3. Use Glide API to add each record in the array to rows in a glide table I specify

If that is correct, are you able to elaborate on steps 2, 3 please?

---

<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:** [July 14, 2025, 10:37pm UTC](https://community.glideapps.com/t/turn-json-array-into-rows-in-separate-table/83153/4 "2025-07-14T22:37:25Z")

</div>

If your JSON is already valid, step 2 would require JSONata or JavaScript (I usually do JavaScript) to turn each element in your JSON array to a format that’s fitting for adding a row in Glide.

Sample mutation in Glide:

```auto
{
      "kind": "add-row-to-table",
      "tableName": "your table's name here",
      "columnValues": {
        "columnID1": "value1",
        "columnID2": "value2"
      }
    }

```

A JavaScript function would convert your raw data into this format, and then you will send an API call to add the rows, with the mutations array in the body of the API call.

```auto
{
  "appID": "appID here",
  "mutations": [
    {
      "kind": "add-row-to-table",
      "tableName": "your table's name here",
      "columnValues": {
        "columnID1": "value1",
        "columnID2": "value2"
      }
    },
{
      "kind": "add-row-to-table",
      "tableName": "your table's name here",
      "columnValues": {
        "columnID1": "value3",
        "columnID2": "value4"
      }
    }
  ]
}

```

---

<div class="post-metadata">

**Author:** ![blairrorani](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/blairrorani/32/43426_2.png) [@blairrorani](https://community.glideapps.com/u/blairrorani)\
**Post date:** [August 7, 2025, 6:35am UTC](https://community.glideapps.com/t/turn-json-array-into-rows-in-separate-table/83153/5 "2025-08-07T06:35:59Z")

</div>

Getting around to this!  
Where am I adding this code? In Glide?

---

<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:** [August 7, 2025, 2:06pm UTC](https://community.glideapps.com/t/turn-json-array-into-rows-in-separate-table/83153/6 "2025-08-07T14:06:54Z")

</div>

The stuff above is just a sample of how your _output_ would look like. You have to construct a JavaScript function to produce the JSON string that looks like this:

```auto
{
  "appID": "appID here",
  "mutations": [
    {
      "kind": "add-row-to-table",
      "tableName": "your table's name here",
      "columnValues": {
        "columnID1": "value1",
        "columnID2": "value2"
      }
    },
{
      "kind": "add-row-to-table",
      "tableName": "your table's name here",
      "columnValues": {
        "columnID1": "value3",
        "columnID2": "value4"
      }
    }
  ]
}

```

Then, make an API call using it as the body (alongside auth headers).

---

<div class="post-metadata">

**Author:** ![blairrorani](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/blairrorani/32/43426_2.png) [@blairrorani](https://community.glideapps.com/u/blairrorani)\
**Post date:** [August 8, 2025, 1:28am UTC](https://community.glideapps.com/t/turn-json-array-into-rows-in-separate-table/83153/7 "2025-08-08T01:28:34Z")

</div>

K.

I do that in a JavaScript column in same sheet as my original JSON right?

---

<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:** [August 8, 2025, 11:46pm UTC](https://community.glideapps.com/t/turn-json-array-into-rows-in-separate-table/83153/8 "2025-08-08T23:46:29Z")

</div>

Yes that’s correct.

Let me know if I can help you with any other stuff here.

Make sure you use a _return_ function at the end to get the output as a JSON string.

---

<div class="post-metadata">

**Author:** ![slscustom.ru](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/slscustom.ru/32/77336_2.png) [@slscustom.ru](https://community.glideapps.com/u/slscustom.ru)\
**Post date:** [August 9, 2025, 9:59pm UTC](https://community.glideapps.com/t/turn-json-array-into-rows-in-separate-table/83153/9 "2025-08-09T21:59:43Z")

</div>

Workflow and production Glide API will costs the same: each row - one update.

Use api V2 instead. 1.add rows to stash. 2. Add rows to table from stash. This way you will have economy

---

<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:** [August 9, 2025, 11:00pm UTC](https://community.glideapps.com/t/turn-json-array-into-rows-in-separate-table/83153/10 "2025-08-09T23:00:07Z")

</div>

Isn’t workflow consuming more because you need to query out the fields, or does it work differently when you pass in a JSON (i.e it automatically paráes the fields out)?

For API v2, isn’t it only for Glide Big Tables at the moment?

---

<div class="post-metadata">

**Author:** ![slscustom.ru](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/slscustom.ru/32/77336_2.png) [@slscustom.ru](https://community.glideapps.com/u/slscustom.ru)\
**Post date:** [August 10, 2025, 1:43am UTC](https://community.glideapps.com/t/turn-json-array-into-rows-in-separate-table/83153/11 "2025-08-10T01:43:29Z")

</div>

Does query consumes updates? I remember no, so why workflow must consuming more?  
Yes, API V2 is for BIG Tables only, for now.  
”Costs the same” in my mind is updates costs only.  
Yes, for Glide Tables, crafting an API body is the best option if API Call is available.

---

<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:** [August 10, 2025, 6:46am UTC](https://community.glideapps.com/t/turn-json-array-into-rows-in-separate-table/83153/12 "2025-08-10T06:46:54Z")

</div>

> [@slscustom.ru](#):
>
> Does query consumes updates?

I checked again and you’re right, only the ones with the lightning icon consume updates.

 ![CleanShot 2025-08-10 at 13.45.55](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/2/0/20eae58f5d125f5ff4722652c92cbc3bb3f2d98b.png)

I was thinking the numbers in bubbles here count, but they’re just showing the amount of runs apparently.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [August 10, 2025, 7:51am UTC](https://community.glideapps.com/t/turn-json-array-into-rows-in-separate-table/83153/13 "2025-08-10T07:51:20Z")

</div>

> [@ThinhDinh](#):
>
> I was thinking the numbers in bubbles here count, but they’re just showing the amount of runs apparently.

Correct.

> [@Loops and limitations](https://community.glideapps.com/t/loops-and-limitations/83408/8):
>
> Each run is one update, and individual steps may use additional updates. If you look at an execution run log, you can calculate exactly how many updates were used. any step that has a small lightning bolt next to it will incur updates the numbers next to each step indicate how many times that step was run Below is an example: In the above example, a total of 5 updates were used.
