# Parse JSON Object into line items

**URL:** <https://community.glideapps.com/t/parse-json-object-into-line-items/79591>\
**Category:** Ask for Help\
**Tags:** json, javascript\
**Created:** [January 27, 2025, 11:00pm UTC](https://community.glideapps.com/t/parse-json-object-into-line-items/79591 "2025-01-27T23:00:55Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![jimmykelly](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jimmykelly/32/80162_2.png) [@jimmykelly](https://community.glideapps.com/u/jimmykelly)\
**Post date:** [January 27, 2025, 11:00pm UTC](https://community.glideapps.com/t/parse-json-object-into-line-items/79591/1 "2025-01-27T23:00:55Z")

</div>

Below is a JSON object that was extracted from an invoice’s line items. I am trying to use this object to create line item records for each invoice.

What is the best way to parse this response into individual objects that I can create records from?

I am assuming that I am going to want to use JSON.parse in a Javascript column, but I am getting stumped on the config for that column.

Thanks in advance.

```auto
{
  "line-items": [
    {
      "date": "09/03/2024",
      "category": "travel",
      "quantity": 1,
      "unit type": "hours",
      "unit price": 125,
      "description": "Road Call Service Charge",
      "line item number": 1,
      "total line item cost": 125
    },
    {
      "date": "09/03/2024",
      "category": "service",
      "quantity": 2,
      "unit type": "hours",
      "unit price": 145,
      "description": "Traveled to troubleshoot generator power issue, discovered bad generator controller.",
      "line item number": 2,
      "total line item cost": 290
    },
    {
      "date": "09/05/2024",
      "category": "travel",
      "quantity": 1,
      "unit type": "hours",
      "unit price": 125,
      "description": "Road Call Service Charge",
      "line item number": 3,
      "total line item cost": 125
    },
    {
      "date": "09/05/2024",
      "category": "service",
      "quantity": 2.5,
      "unit type": "hours",
      "unit price": 145,
      "description": "Removed & replaced generator controller; calibrated new controller.",
      "line item number": 4,
      "total line item cost": 362.5
    },
    {
      "date": "09/05/2024",
      "category": "parts",
      "quantity": 1,
      "unit type": "units",
      "unit price": 1396.74,
      "description": "Onan Controller",
      "line item number": 5,
      "total line item cost": 1396.74
    },
    {
      "date": "09/05/2024",
      "category": "parts",
      "quantity": 1,
      "unit type": "units",
      "unit price": 62.62,
      "description": "Shipping",
      "line item number": 6,
      "total line item cost": 62.62
    },
    {
      "date": "09/05/2024",
      "category": "fees",
      "quantity": 1,
      "unit type": "units",
      "unit price": 75.55,
      "description": "Credit Card Convenience Fee",
      "line item number": 7,
      "total line item cost": 75.55
    }
  ]
}

```

---

<div class="post-metadata">

**Author:** ![MaximeBaker](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/maximebaker/32/80877_2.png) [@MaximeBaker](https://community.glideapps.com/u/MaximeBaker)\
**Post date:** [January 27, 2025, 11:33pm UTC](https://community.glideapps.com/t/parse-json-object-into-line-items/79591/2 "2025-01-27T23:33:59Z")

</div>

You would need multiple query json column to make this working. But since you have arrays, you could potentially use webhook workflow to loop in the json array and add row for each element. What do you think?

---

<div class="post-metadata">

**Author:** ![MaximeBaker](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/maximebaker/32/80877_2.png) [@MaximeBaker](https://community.glideapps.com/u/MaximeBaker)\
**Post date:** [January 27, 2025, 11:35pm UTC](https://community.glideapps.com/t/parse-json-object-into-line-items/79591/3 "2025-01-27T23:35:07Z")

</div>

Another use case that I can explain to you, is build a Glide API body with multiple Mutations to add multiple rows with a single API call.

---

<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:** [January 28, 2025, 1:11am UTC](https://community.glideapps.com/t/parse-json-object-into-line-items/79591/4 "2025-01-28T01:11:06Z")

</div>

I have done this in a lot of apps, I think it’s good to use, as long as you stay under something like 500 rows.

> [@MaximeBaker](#):
>
> Another use case that I can explain to you, is build a Glide API body with multiple Mutations to add multiple rows with a single API call.

---

<div class="post-metadata">

**Author:** ![jimmykelly](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jimmykelly/32/80162_2.png) [@jimmykelly](https://community.glideapps.com/u/jimmykelly)\
**Post date:** [January 28, 2025, 12:36pm UTC](https://community.glideapps.com/t/parse-json-object-into-line-items/79591/5 "2025-01-28T12:36:44Z")

</div>

How would get the workflow to identify the elements within the object? I was thinking if I could figure out a way to format this as individual objects then I would be able to loop a workflow that queries each variable and creates an item for each object.

---

<div class="post-metadata">

**Author:** ![jimmykelly](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jimmykelly/32/80162_2.png) [@jimmykelly](https://community.glideapps.com/u/jimmykelly)\
**Post date:** [January 28, 2025, 12:38pm UTC](https://community.glideapps.com/t/parse-json-object-into-line-items/79591/6 "2025-01-28T12:38:58Z")

</div>

Worst case scenario, I would be looking at running 50 line items for each invoice. Most of the time it is 2-10 items.

---

<div class="post-metadata">

**Author:** ![MaximeBaker](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/maximebaker/32/80877_2.png) [@MaximeBaker](https://community.glideapps.com/u/MaximeBaker)\
**Post date:** [January 28, 2025, 1:07pm UTC](https://community.glideapps.com/t/parse-json-object-into-line-items/79591/7 "2025-01-28T13:07:49Z")

</div>

With the query JSON (if you send the full data in the body of your webhook call) or with a simple query to get the data from a specific location in your tables. Then be able to loop in that object. Does it make more sense ?

---

<div class="post-metadata">

**Author:** ![MaximeBaker](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/maximebaker/32/80877_2.png) [@MaximeBaker](https://community.glideapps.com/u/MaximeBaker)\
**Post date:** [January 28, 2025, 1:08pm UTC](https://community.glideapps.com/t/parse-json-object-into-line-items/79591/8 "2025-01-28T13:08:26Z")

</div>

How often? You need to have this in mind for optimizing your updates usage.

---

<div class="post-metadata">

**Author:** ![jimmykelly](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jimmykelly/32/80162_2.png) [@jimmykelly](https://community.glideapps.com/u/jimmykelly)\
**Post date:** [January 28, 2025, 1:21pm UTC](https://community.glideapps.com/t/parse-json-object-into-line-items/79591/9 "2025-01-28T13:21:09Z")

</div>

I am not following on this one

---

<div class="post-metadata">

**Author:** ![jimmykelly](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jimmykelly/32/80162_2.png) [@jimmykelly](https://community.glideapps.com/u/jimmykelly)\
**Post date:** [January 28, 2025, 1:22pm UTC](https://community.glideapps.com/t/parse-json-object-into-line-items/79591/10 "2025-01-28T13:22:14Z")

</div>

Right now, it is a fairly low volume. A couple times a month, but I am anticipating that it will ramp up in the next 90 days, so I would rather pursue the most scalable options
