# Hitting a wall, JSON Template won't pull dynamic values

**URL:** <https://community.glideapps.com/t/hitting-a-wall-json-template-wont-pull-dynamic-values/75663>\
**Category:** Ask for Help\
**Created:** [August 15, 2024, 2:30pm UTC](https://community.glideapps.com/t/hitting-a-wall-json-template-wont-pull-dynamic-values/75663 "2024-08-15T14:30:43Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jordan\_Olivas](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jordan_olivas/32/78657_2.png) [@Jordan\_Olivas](https://community.glideapps.com/u/Jordan_Olivas)\
**Post date:** [August 15, 2024, 2:30pm UTC](https://community.glideapps.com/t/hitting-a-wall-json-template-wont-pull-dynamic-values/75663/1 "2024-08-15T14:30:43Z")

</div>

I have the below template; however, when I try to query dynamic values from the same table, they aren’t pulling. I’ve checked the docs and videos but still no luck. Thoughts?

TEMPLATE:

{  
“model”: “claude-3-opus-20240229”,  
“max\_tokens”: 1000,  
“system”: [  
{  
“type”: “text”,  
“text”: “prompt.”  
}  
],  
“messages”: [  
{  
“role”: “user”,  
“content”: "prompt data.

Age: $age  
Postal Code: $postal\_code  
Gender: $gender  
Traffic Source: $traffic\_source

prompt"  
}  
]  
}

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/d/9/d9c41ed35d340cc0a6e4e40fde44041cc4a0d816.jpeg)

---

<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 15, 2024, 2:42pm UTC](https://community.glideapps.com/t/hitting-a-wall-json-template-wont-pull-dynamic-values/75663/2 "2024-08-15T14:42:46Z")

</div>

Maybe the new line characters in your content variable is making it an invalid JSON.

What are you trying to do though? You’re constructing what looks like a body of an API call, but now you want to query from that body?

---

<div class="post-metadata">

**Author:** ![Jordan\_Olivas](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jordan_olivas/32/78657_2.png) [@Jordan\_Olivas](https://community.glideapps.com/u/Jordan_Olivas)\
**Post date:** [August 15, 2024, 2:59pm UTC](https://community.glideapps.com/t/hitting-a-wall-json-template-wont-pull-dynamic-values/75663/4 "2024-08-15T14:59:15Z")

</div>

Gave that a try as well, no luck unfortunately .

I wonder if because I’m passing a json structure within a quoted json object, that I may need to dynamically place a nested JSON?

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

---

<div class="post-metadata">

**Author:** ![Jordan\_Olivas](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jordan_olivas/32/78657_2.png) [@Jordan\_Olivas](https://community.glideapps.com/u/Jordan_Olivas)\
**Post date:** [August 15, 2024, 3:07pm UTC](https://community.glideapps.com/t/hitting-a-wall-json-template-wont-pull-dynamic-values/75663/5 "2024-08-15T15:07:23Z")

</div>

in this simple test yes it does work, but its like any time I put in the $ it basically breaks it. Is it because I’m trying to pass dynamic data within the “” for the original JSON message?

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

---

<div class="post-metadata">

**Author:** ![Jordan\_Olivas](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jordan_olivas/32/78657_2.png) [@Jordan\_Olivas](https://community.glideapps.com/u/Jordan_Olivas)\
**Post date:** [August 15, 2024, 3:14pm UTC](https://community.glideapps.com/t/hitting-a-wall-json-template-wont-pull-dynamic-values/75663/6 "2024-08-15T15:14:14Z")

</div>

> [@ThinhDinh](#):
>
> your content varia

I took those out just in case and still the same issue.

I’m trying to pass dynamic content into the text of the prompt I’m sending to Anthropic’s API. I’m 99% certain its because I put the data in “”, so then when I try to pass dynamic variables into the literal text, it wont make it dynamic, but unsure how you would pass dynamic content within a json request unless I remove the “”?

The issue is if I remove the “” it breaks the json template

---

<div class="post-metadata">

**Author:** ![gvalero](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/gvalero/32/1037_2.png) [@gvalero](https://community.glideapps.com/u/gvalero)\
**Post date:** [August 15, 2024, 3:15pm UTC](https://community.glideapps.com/t/hitting-a-wall-json-template-wont-pull-dynamic-values/75663/7 "2024-08-15T15:15:10Z")

</div>

Ah!.. you are using the JSON Template column, not the original Template, sorry for my confusion.

Let’s test with this small example (template) to validate syntax and variables:

```auto
{
  "model": "claude-3-opus-20240229",
  "max_tokens": 1000,
  "system": [
    {
      "type": "text",
      "text": "prompt."
    }
  ],
  "messages": [
    {
      "role": "user",
      "content": "prompt data.",
      "Age": $age,
      "Postal Code": $postal_code,
      "Gender": "$gender",
      "Traffic Source": "$traffic_source"
    }
  ]
}

```

Let me know if it worked

---

<div class="post-metadata">

**Author:** ![Jordan\_Olivas](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jordan_olivas/32/78657_2.png) [@Jordan\_Olivas](https://community.glideapps.com/u/Jordan_Olivas)\
**Post date:** [August 15, 2024, 3:24pm UTC](https://community.glideapps.com/t/hitting-a-wall-json-template-wont-pull-dynamic-values/75663/8 "2024-08-15T15:24:27Z")

</div>

Simplified to:

{  
“model”: “claude-3-opus-20240229”,  
“max\_tokens”: 1000,  
“system”: [  
{  
“type”: “text”,  
“text”: “prompt.”  
}  
],  
“messages”: [  
{  
“Gender”: “$gender”  
}  
]  
}

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/1/a/1a26db4d841c3d2c90d2a53bb0322bcde293ac9c.png)  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/3/3/3356437d68eaba86fc9550eb92bb4251fd939bfd.png)

---

<div class="post-metadata">

**Author:** ![Jordan\_Olivas](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jordan_olivas/32/78657_2.png) [@Jordan\_Olivas](https://community.glideapps.com/u/Jordan_Olivas)\
**Post date:** [August 15, 2024, 3:31pm UTC](https://community.glideapps.com/t/hitting-a-wall-json-template-wont-pull-dynamic-values/75663/9 "2024-08-15T15:31:29Z")

</div>

```auto
{
  "model": "claude-3-opus-20240229",
  "max_tokens": 1000,
  "system": [
    {
      "type": "text",
      "text": "text input"
    }
  ],
  "messages": [
    {
      "role": "user",
      "content": "content"

    }
  ]
}

```

Here is a simplified version

---

<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 15, 2024, 3:34pm UTC](https://community.glideapps.com/t/hitting-a-wall-json-template-wont-pull-dynamic-values/75663/10 "2024-08-15T15:34:10Z")

</div>

Side note: when posting JSON you can use triple-backticks and it will format nicely. I fixed that last one for you.

---

<div class="post-metadata">

**Author:** ![Jordan\_Olivas](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jordan_olivas/32/78657_2.png) [@Jordan\_Olivas](https://community.glideapps.com/u/Jordan_Olivas)\
**Post date:** [August 15, 2024, 4:06pm UTC](https://community.glideapps.com/t/hitting-a-wall-json-template-wont-pull-dynamic-values/75663/11 "2024-08-15T16:06:12Z")

</div>

Can you show me what you mean? as a note I tried to pass multiple messages to Anthropic’s API but it doesn’t allow it unfortuantely.

---

<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 15, 2024, 4:10pm UTC](https://community.glideapps.com/t/hitting-a-wall-json-template-wont-pull-dynamic-values/75663/12 "2024-08-15T16:10:15Z")

</div>

If you edit your previous post you’ll see what I mean.

---

<div class="post-metadata">

**Author:** ![Jordan\_Olivas](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jordan_olivas/32/78657_2.png) [@Jordan\_Olivas](https://community.glideapps.com/u/Jordan_Olivas)\
**Post date:** [August 15, 2024, 4:22pm UTC](https://community.glideapps.com/t/hitting-a-wall-json-template-wont-pull-dynamic-values/75663/14 "2024-08-15T16:22:58Z")

</div>

json

```auto
{
“model”: “claude-3-opus-20240229”,
“max_tokens”: 1000,
“system”: [
{
“type”: “text”,
“text”: “prompt.”
}
],
“messages”: [
{
“role”: “user”,
“content”: "prompt data.

Age: $age
Postal Code: $postal_code
Gender: $gender
Traffic Source: $traffic_source

prompt"
}
]
}

```

---

<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 15, 2024, 4:28pm UTC](https://community.glideapps.com/t/hitting-a-wall-json-template-wont-pull-dynamic-values/75663/15 "2024-08-15T16:28:22Z")

</div>

Looks like you are using smart quotes. You need to use back ticks, and put them on a separate line, like below:

 ![CleanShot 2024-08-16 at 00.25.46@2x](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/5/8/58a4d27814459caf967ef7c564f6972d7b37cf29.jpeg)

The problem if you just paste the JSON without using the back ticks is that all the double quotes get converted to smart quotes, and it breaks the JSON. This makes it harder for anyone that is trying to help you.

---

<div class="post-metadata">

**Author:** ![gvalero](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/gvalero/32/1037_2.png) [@gvalero](https://community.glideapps.com/u/gvalero)\
**Post date:** [August 15, 2024, 4:30pm UTC](https://community.glideapps.com/t/hitting-a-wall-json-template-wont-pull-dynamic-values/75663/16 "2024-08-15T16:30:27Z")

</div>

Jordan,

Use this option to paste your code in order to avoid some invalid characters like your **“ ”**.  
You must use these instead: **" "**  
Did you see the difference?

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

---

<div class="post-metadata">

**Author:** ![Jordan\_Olivas](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jordan_olivas/32/78657_2.png) [@Jordan\_Olivas](https://community.glideapps.com/u/Jordan_Olivas)\
**Post date:** [August 15, 2024, 4:43pm UTC](https://community.glideapps.com/t/hitting-a-wall-json-template-wont-pull-dynamic-values/75663/17 "2024-08-15T16:43:24Z")

</div>

Thank you!! Here is the current simplified version that I have but still cant get dynamic content in

{  
“model”: “claude-3-opus-20240229”,  
“max\_tokens”: 1000,  
“system”: “You are an AI assistant tasked with classifying users based on provided information.”,  
“messages”: [  
{  
“role”: “user”,  
“content”: “Tell me how you would classify this user in 10 words or less as a person Gender:$gender”  
}  
]  
}

```auto

{
  "model": "claude-3-opus-20240229",
  "max_tokens": 1000,
  "system": "You are an AI assistant tasked with classifying users based on provided information.",
  "messages": [
    {
      "role": "user",
      "content": "Tell me how you would classify this user in 10 words or less as a person Gender:$gender" 
    }
  ]
}

```

---

<div class="post-metadata">

**Author:** ![Jordan\_Olivas](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jordan_olivas/32/78657_2.png) [@Jordan\_Olivas](https://community.glideapps.com/u/Jordan_Olivas)\
**Post date:** [August 15, 2024, 5:15pm UTC](https://community.glideapps.com/t/hitting-a-wall-json-template-wont-pull-dynamic-values/75663/18 "2024-08-15T17:15:01Z")

</div>

Found the solution!!

1. create the json as a normal text Template column
2. have a dynamic reference in a new column for JSON Template of the Template column above

---

<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 15, 2024, 11:26pm UTC](https://community.glideapps.com/t/hitting-a-wall-json-template-wont-pull-dynamic-values/75663/19 "2024-08-15T23:26:57Z")

</div>

```auto
{
  "model": "claude-3-opus-20240229",
  "max_tokens": 1000,
  "system": [
    {
      "type": $text,
      "text": $textInput
    }
  ],
  "messages": [
    {
      "role": $role,
      "content": $content
    }
  ]
}

```

This works normally for me.

---

<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 15, 2024, 11:29pm UTC](https://community.glideapps.com/t/hitting-a-wall-json-template-wont-pull-dynamic-values/75663/20 "2024-08-15T23:29:22Z")

</div>

> [@Jordan\_Olivas](#):
>
> `"content": "Tell me how you would classify this user in 10 words or less as a person Gender:$gender"`

Also, the $gender binder here can’t work if you are trying to have that inside double quotes. It seems like you can only tie values/objects directly to a variable, not inside another value like that. If you want to do that, using a template column before that, just for that value, is the way to go.

---

<div class="post-metadata">

**Author:** ![Jordan\_Olivas](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jordan_olivas/32/78657_2.png) [@Jordan\_Olivas](https://community.glideapps.com/u/Jordan_Olivas)\
**Post date:** [August 16, 2024, 2:54am UTC](https://community.glideapps.com/t/hitting-a-wall-json-template-wont-pull-dynamic-values/75663/21 "2024-08-16T02:54:51Z")

</div>

The issue here is passing a static command + dynamic content

---

<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 16, 2024, 8:08am UTC](https://community.glideapps.com/t/hitting-a-wall-json-template-wont-pull-dynamic-values/75663/22 "2024-08-16T08:08:31Z")

</div>

Yeah, I mean if you want a dynamic value inside a variable, using the template column beforehand makes sense.

[Next page](https://community.glideapps.com/t/hitting-a-wall-json-template-wont-pull-dynamic-values/75663.md?page=2)
