# Help to understand the Different outputs from JSON Template column vs. normal template column

**URL:** <https://community.glideapps.com/t/help-to-understand-the-different-outputs-from-json-template-column-vs-normal-template-column/80134>\
**Category:** Ask for Help\
**Created:** [February 18, 2025, 4:25am UTC](https://community.glideapps.com/t/help-to-understand-the-different-outputs-from-json-template-column-vs-normal-template-column/80134 "2025-02-18T04:25:52Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![schrutefarms](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/schrutefarms/32/59686_2.png) [@schrutefarms](https://community.glideapps.com/u/schrutefarms)\
**Post date:** [February 18, 2025, 4:25am UTC](https://community.glideapps.com/t/help-to-understand-the-different-outputs-from-json-template-column-vs-normal-template-column/80134/1 "2025-02-18T04:25:53Z")

</div>

Hi,

I would like to understand the difference in output between the Template column and the JSON Template column in this specific case. I am trying to create a API payload for the Call API like this:

**1. Using a JSON Object column to create columnValues. The column outputs this:**

```auto
{
  "1RRR0": "rRoW8v6HT4qJoTSb1fIDcw",
  "Usz92": "d11e140a-877a-41b0-b530-3769d17ab3cb"
}

```

**2. Using a JavaScript column to create mutations. The column outputs this:**

```auto
[{"kind": "add-row-to-table", "tableName": "native-table-OixoB8WxaCD1brEuIgw2", "columnValues": {"1RRR0":"IAj1kNiHSbG1dUa3Xzy3yg","Usz92":"ff90fdcd-11a4-4ca2-8084-8e5baa1b7da3"}}]

```

**3. When using a JSON Template columnd to create the payload it looks like it is converting the array into a string, because the output looks like this:**

```auto
{
  "appID": "Xn0neojnKCfEmqgybd6D",
  "mutations": "[{\"kind\": \"add-row-to-table\", \"tableName\": \"native-table-OixoB8WxaCD1brEuIgw2\", \"columnValues\": {\"1RRR0\":\"IAj1kNiHSbG1dUa3Xzy3yg\",\"Usz92\":\"ff90fdcd-11a4-4ca2-8084-8e5baa1b7da3\"}}]"
}

```

However, when I use a normal template column with the same settings, I get the output that I need to create the payload:

```auto
{
  "appID": "Xn0neojnKCfEmqgybd6D",
  "mutations": [{"kind": "add-row-to-table", "tableName": "native-table-OixoB8WxaCD1brEuIgw2", "columnValues": {"1RRR0":"IAj1kNiHSbG1dUa3Xzy3yg","Usz92":"ff90fdcd-11a4-4ca2-8084-8e5baa1b7da3"}}]
}

```

Can someone please explain why this is happening? I am trying my best to learn JSON and use it more, but I am really struggling to understand 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:** [February 18, 2025, 4:56am UTC](https://community.glideapps.com/t/help-to-understand-the-different-outputs-from-json-template-column-vs-normal-template-column/80134/2 "2025-02-18T04:56:35Z")

</div>

The problem is that the JavaScript column is not “JSON aware”, and so it returns a stringified version of the JSON rather than a JSON object.

It’s best to avoid using JavaScript to generate JSON where ever possible, and stick to the native JSON columns that Glide provides. I know this isn’t always possible, but you just need to be aware of the difference.

---

<div class="post-metadata">

**Author:** ![schrutefarms](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/schrutefarms/32/59686_2.png) [@schrutefarms](https://community.glideapps.com/u/schrutefarms)\
**Post date:** [February 18, 2025, 5:00am UTC](https://community.glideapps.com/t/help-to-understand-the-different-outputs-from-json-template-column-vs-normal-template-column/80134/3 "2025-02-18T05:00:58Z")

</div>

Thank you! I understand. So in this case, what would be the preferred way to handle it? Since I need to use the JavaScript column in this case, should I just keep using the normal Template Column? Or is there a better way to approach this. Just want to make sure that I follow good practices here.

---

<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:** [February 18, 2025, 5:05am UTC](https://community.glideapps.com/t/help-to-understand-the-different-outputs-from-json-template-column-vs-normal-template-column/80134/4 "2025-02-18T05:05:46Z")

</div>

My rule of thumb for generating JSON is that I will always use the native JSON columns where I can, and will only turn to JavaScript as a last resort.

---

<div class="post-metadata">

**Author:** ![schrutefarms](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/schrutefarms/32/59686_2.png) [@schrutefarms](https://community.glideapps.com/u/schrutefarms)\
**Post date:** [February 18, 2025, 5:13am UTC](https://community.glideapps.com/t/help-to-understand-the-different-outputs-from-json-template-column-vs-normal-template-column/80134/5 "2025-02-18T05:13:32Z")

</div>

Understood. My use case here is what was discussed in the thread below and I chose to go with the JavaScript approach so I guess in this case I will need to use the Template column.

> [@Convert Line Items into Individual Rows based on qty](https://community.glideapps.com/t/convert-line-items-into-individual-rows-based-on-qty/79564/8):
>
> I think JavaScript is definitely the way to go here. I would prepare an input that represents all items that you need to be added, alongside the quantity, and then run it through JS to get the output. Next, run an API call step and I think you’re good to go.

---

<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:** [February 18, 2025, 5:16am UTC](https://community.glideapps.com/t/help-to-understand-the-different-outputs-from-json-template-column-vs-normal-template-column/80134/6 "2025-02-18T05:16:22Z")

</div>

ah, right. Yeah I think that is an example of a use case where you might need to use JavaScript.

---

<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:** [February 18, 2025, 8:27am UTC](https://community.glideapps.com/t/help-to-understand-the-different-outputs-from-json-template-column-vs-normal-template-column/80134/7 "2025-02-18T08:27:26Z")

</div>

You still use this, then in the step just before using JSON Template, you:

- Create a JSON Query column, call it something like “JSON Formatted”.
- Target the result of the JavaScript column.
- Don’t write any queries, it should be kept empty.
- Use the result of JSON Query in your final JSON Object column.

---

<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:** [February 18, 2025, 8:47am UTC](https://community.glideapps.com/t/help-to-understand-the-different-outputs-from-json-template-column-vs-normal-template-column/80134/8 "2025-02-18T08:47:58Z")

</div>

ah, nice. That never occurred to me

---

<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:** [February 25, 2025, 8:48am UTC](https://community.glideapps.com/t/help-to-understand-the-different-outputs-from-json-template-column-vs-normal-template-column/80134/9 "2025-02-25T08:48:23Z")

</div>

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