web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Copilot Studio / Need Help : Rendering ...
Copilot Studio
Suggested Answer

Need Help : Rendering Dynamic Adaptive Card

(2) ShareShare
ReportReport
Posted on by 6
Hello All,

I generated rendom dynamic adaptive card using AI prompt with powerautomate, see below example 
 
Example 1
{ type: "AdaptiveCard", '$schema': "​http://adaptivecards.io/schemas/adaptive-card.json​", version: "1.4", body: [ { type: "Container", style: "emphasis", spacing: "None", bleed: true, items: [ { type: "Image", url: "data:image/svg+xml;utf8,Leave request", size: "Stretch", altText: "Header" } ] }, { type: "Input.ChoiceSet", id: "leaveType", label: "Leave request", style: "compact", isMultiSelect: false, placeholder: "Select an option", choices: [ { title: "Sick Leave", value: "sick" }, { title: "Vacation Leave", value: "vacation" }, { title: "Personal Leave", value: "personal" } ] }, { type: "Input.ChoiceSet", id: "approval", label: "Approve leave?", style: "expanded", isMultiSelect: false, choices: [ { title: "Yes", value: "yes" }, { title: "No", value: "no" } ] } ], actions: [ { type: "Action.Submit", title: "Approve", style: "positive", data: { action: "approve" } }, { type: "Action.Submit", title: "Reject", style: "destructive", data: { action: "reject" } } ] }

I saved this value as cardJson, I directly this value in added adaptive card as ParseJson(Topic.cardJson), but it looks this is not correct approach. 


Example 2
{ type: "Container", style: "emphasis", spacing: "None", bleed: true, items: [ { type: "Image", url: "data:image/svg+xml;utf8,Leave request", size: "Stretch", altText: "Header" } ] }, { type: "Input.ChoiceSet", id: "leaveType", label: "Leave request", style: "compact", isMultiSelect: false, placeholder: "Select an option", choices: [ { title: "Sick Leave", value: "sick" }, { title: "Vacation Leave", value: "vacation" }, { title: "Personal Leave", value: "personal" } ] }, { type: "Input.ChoiceSet", id: "approval", label: "Approve leave?", style: "expanded", isMultiSelect: false, choices: [ { title: "Yes", value: "yes" }, { title: "No", value: "no" } ] } ]

i saved this value CardJson1. Then added adaptive card passthe values in adaptive card
{
  type: "AdaptiveCard",
  '$schema': "http://adaptivecards.io/schemas/adaptive-card.json",
  version: "1.0",
  body: [ Topic.cardJson2
  ]
}

Am I missing anything here, please help.

FYI, I am using Forumala card, not Json format in adaptive card.



Regards
Ashu
I have the same question (0)
  • Suggested answer
    Haque Profile Picture
    3,202 on at
    Hi @AvuanDecosta,
     
     
    When you save your Adaptive Card JSON as a string (e.g., in cardJson) and then try to use ParseJson(Topic.cardJson) directly in Power Apps to render the card, it often doesn’t work because:
    • The JSON string must be a complete Adaptive Card object, including the top-level properties like type, $schema, and version.
    • Your Example 2 is a partial card body (an array of containers and inputs) but missing the wrapping Adaptive Card structure.
    • ParseJson expects a valid JSON string representing the entire card, not just fragments.When you save your Adaptive Card JSON as a string (e.g., in cardJson) and then try to use ParseJson(Topic.cardJson) directly in Power Apps to render the card, it often doesn’t work because:
    • The JSON string must be a complete Adaptive Card object, including the top-level properties like type, $schema, and version.
    • Your Example 2 is a partial card body (an array of containers and inputs) but missing the wrapping Adaptive Card structure.
    • ParseJson expects a valid JSON string representing the entire card, not just fragments.
     
    Make sure your saved JSON string includes the full Adaptive Card structure, for example:
    {
      "type": "AdaptiveCard",
      "$schema": "https://adaptivecards.io/schemas/adaptive-card.json",
      "version": "1.4",
      "body": [
        {
          "type": "Container",
          "style": "emphasis",
          "spacing": "None",
          "bleed": true,
          "items": [
            {
              "type": "Image",
              "url": "https://example.com/yourimage.png",
              "size": "Stretch",
              "altText": "Header"
            }
          ]
        },
        {
          "type": "Input.ChoiceSet",
          "id": "leaveType",
          "label": "Leave request",
          "style": "compact",
          "isMultiSelect": false,
          "placeholder": "Select an option",
          "choices": [
            { "title": "Sick Leave", "value": "sick" },
            { "title": "Vacation Leave", "value": "vacation" },
            { "title": "Personal Leave", "value": "personal" }
          ]
        },
        {
          "type": "Input.ChoiceSet",
          "id": "approval",
          "label": "Approve leave?",
          "style": "expanded",
          "isMultiSelect": false,
          "choices": [
            { "title": "Yes", "value": "yes" },
            { "title": "No", "value": "no" }
          ]
        }
      ],
      "actions": [
        {
          "type": "Action.Submit",
          "title": "Approve",
          "style": "positive",
          "data": { "action": "approve" }
        },
        {
          "type": "Action.Submit",
          "title": "Reject",
          "style": "destructive",
          "data": { "action": "reject" }
        }
      ]
    }
    
    Store this entire JSON string in your cardJson variable or data source. Use ParseJson(Topic.cardJson) to convert it into a JSON object that the Adaptive Card control can render.
    Also, ensure your image URLs are valid URLs or base64-encoded images. The "data:image/svg+xml;utf8,Leave request" is not a valid image source.

    I am sure some clues I tried to give. If these clues help to resolve the issue brought you by here, please don't forget to check the box Does this answer your question? At the same time, I am pretty sure you have liked the response!
  • Suggested answer
    11manish Profile Picture
    2,301 on at
    It seems the main issue is that:
    • Formula Adaptive Card mode does NOT dynamically deserialize JSON strings into card objects
    So:
    • body: [ Topic.cardJson2 ]
    will not work because the value is treated as text, not an Adaptive Card object.
  • Suggested answer
    Valantis Profile Picture
    5,267 on at
     
    Since you're using Formula card mode, ParseJson and passing a JSON string variable directly into the body array won't work. Formula card mode expects actual Power Fx objects and expressions, not a serialized JSON string.
     
    Formula card mode doesn't support dynamic deserialization of a JSON string at runtime. You can't store a full card as a string and inject it into a Formula card.
     
    You have two options:
     
    Option 1: Switch to JSON card mode
    If your card is fully dynamic and AI-generated, use JSON mode instead of Formula mode. In JSON mode you can pass a complete JSON string directly. Store the full Adaptive Card JSON (including type, $schema, version, body, actions) as a string variable, then reference it directly in the JSON card node. This is the correct approach when the card structure itself is dynamic.
     
    Option 2: Stay in Formula mode but build the card statically
    If the card structure is always the same and only the data inside it changes (like the choices or labels), keep Formula mode and hardcode the card structure. Use Topic variables only for the dynamic values inside the card, not for the entire card JSON.
    For example in Formula mode:
    {
      type: "Input.ChoiceSet",
      id: "leaveType",
      label: "Leave request",
      choices: Topic.choicesVariable
    }
    For a fully AI-generated dynamic card where the structure itself changes each time, JSON mode is the right choice.
     

     

    Best regards,

    Valantis

     

    ✅ If this helped solve your issue, please Accept as Solution so others can find it quickly.

    ❤️ If it didn’t fully solve it but was still useful, please click “Yes” on “Was this reply helpful?” or leave a Like :).

    🏷️ For follow-ups  @Valantis.

    📝 https://valantisond365.com/

    💼 LinkedIn

    ▶️ YouTube

  • Suggested answer
    Sayali Profile Picture
    Microsoft Employee on at
    Hello @AvuanDecosta,
     
    The issue is mainly due to how Formula cards handle data. In Copilot Studio, you shouldn’t use ParseJSON, as Formula mode expects a Power Fx object, not a string. Also, the body field must always be a proper array of elements—passing a single object or string will break rendering.

    The correct approach is to either store and pass the entire Adaptive Card object directly, or ensure that any dynamic body you inject is already structured as an array.

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Copilot Studio

#1
Valantis Profile Picture

Valantis 639

#2
Vish WR Profile Picture

Vish WR 293

#3
Haque Profile Picture

Haque 216

Last 30 days Overall leaderboard