# Nesting JSON templates being treated as strings

**URL:** <https://community.glideapps.com/t/nesting-json-templates-being-treated-as-strings/79267>\
**Category:** Ask for Help\
**Created:** [January 17, 2025, 12:16pm UTC](https://community.glideapps.com/t/nesting-json-templates-being-treated-as-strings/79267 "2025-01-17T12:16:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jon\_L](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jon_l/32/53227_2.png) [@Jon\_L](https://community.glideapps.com/u/Jon_L)\
**Post date:** [January 17, 2025, 12:16pm UTC](https://community.glideapps.com/t/nesting-json-templates-being-treated-as-strings/79267/1 "2025-01-17T12:16:19Z")

</div>

I’m trying to capture an Inventory Snapshot. I’m creating a JSON of the values in my inventory row (product, quantity, location etc) using the JSON Template column.  
In another JSON template column I’m going to wrap these all up as an array to create the complete Inventory Snapshot with this template:

```auto
{"date": $date_val, "Inventory": [$inventory_val]}

```

I create a joined list of all the row JSONs so that I can create the array of inventory items which is substituted for $inventory\_val in the template.

All of the components seem to work fine, until I look at the final output, in which case I get something like this:

```auto
  "Date": "2025-01-17T12:12:43.340Z",
  "Inventory": [
    "{\"Location\":\"D9-1\",\"Is_Empty\":false,\"Pallet_Number\":\"P0093\",\"Description\":\"TD Stock\"}, {\"Location\":\"D11-1\",\"Is_Empty\":true,\"Pallet_Number\":\"P0130\",\"Description\":\"Corks / Blue Sleeves\",\"Quantity\":0}, {\"Location\":\"A5-4\",\"Is_Empty\":false,\"Pallet_Number\":\"P0137\",\"Description\":\"Unusable Space\"}

```

I asked Claude for help to understand what this was called and he said this:

> The problem is that the inventory array contains JSON strings of the rows, rather than the actual JSON objects. This means each row is being treated as a single string (with escaped quotes) rather than as a JSON object

So I have a description of the problem, but I have no idea how to deal with it.

Anyone got any ideas?

---

<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:** [January 17, 2025, 12:19pm UTC](https://community.glideapps.com/t/nesting-json-templates-being-treated-as-strings/79267/2 "2025-01-17T12:19:25Z")

</div>

Use a lookup instead of a joined list.

---

<div class="post-metadata">

**Author:** ![Jon\_L](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jon_l/32/53227_2.png) [@Jon\_L](https://community.glideapps.com/u/Jon_L)\
**Post date:** [January 17, 2025, 12:24pm UTC](https://community.glideapps.com/t/nesting-json-templates-being-treated-as-strings/79267/3 "2025-01-17T12:24:56Z")

</div>

Dude… you’re obviously a legend here, but now you’re my legend 🤣

I’ve not had any circumstances where a lookup array has been able to be used as text in anything until now - only ever as an input to some computed column that parses arrays. I wish there was more documentation about that, but it is what it is.

Thank you!

I may be pushing my luck, but if you have any other tips or tricks for when an array can be used as an input I’d love it!

---

<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:** [January 17, 2025, 12:37pm UTC](https://community.glideapps.com/t/nesting-json-templates-being-treated-as-strings/79267/4 "2025-01-17T12:37:02Z")

</div>

> [@Jon\_L](#):
>
> I wish there was more documentation about that, but it is what it is.

Yeah, this is not mentioned in the documentation, which is a bit of an oversight I guess. It’s just one of those things that once you know it, you know it 😉

> [@Jon\_L](#):
>
> I may be pushing my luck, but if you have any other tips or tricks for when an array can be used as an input I’d love it!

Nothing that comes immediately to mind. In this case, your JSON Template is expecting an array, and that’s what the Lookup column provides. A Joined List is not strictly an array.

---

<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:** [January 24, 2025, 12:37pm UTC](https://community.glideapps.com/t/nesting-json-templates-being-treated-as-strings/79267/5 "2025-01-24T12:37:31Z")

</div>

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