[Authoring] Templating doesn't support JSON keys with whitespace
Target Application
Teams, Copilot
Application Operating System
Windows
Schema Version
1.4
Problem Description
Given this card
{
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"text": "Product ${product}"
},
{
"type": "TextBlock",
"text": "Price ${unit price}"
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.6"
}
and this payload
{
"product": "Widget",
"unit price": "$42"
}
The card does not render at all in the designer. I could not find any documentation on the differences between property names as supported in the binding syntax vs. legal JSON key names. I tried a variety of escaping techniques with no success.
Expected Outcome
A way to bind to a JSON key that contains whitespace.
Actual Outcome
Card does not render in the designer Value is rendered as "${unit price}" in Copilot
Card JSON
{
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"text": "Product ${product}"
},
{
"type": "TextBlock",
"text": "Price ${unit price}"
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.6"
}
Repro Steps
No response
Thank you for raising your issue. We will check this and will get back to you shortly.
Hi @jvert , Thank you for reporting this issue.
The behavior you're observing is due to a current limitation in the Adaptive Cards templating engine. Specifically, binding expressions do not support JSON keys that contain whitespace (e.g., "unit price"). As a result, expressions such as ${unit price} are not parsed correctly, which can lead to rendering failures or fallback behavior.
To resolve this, we recommend one of the following approaches:
Rename keys in your data model
-
Update your payload to use keys without spaces:
{ "type": "TextBlock", "text": "Price ${unit_price}" } -
Preprocess your data before binding: If you do not control the data source, consider preprocessing the payload to convert keys with spaces into a more template-friendly format (e.g., replacing spaces with underscores) before rendering the card.
Thanks, Keshav