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 / Power Automate / setProperty for comple...
Power Automate
Unanswered

setProperty for complex JSON objects

(0) ShareShare
ReportReport
Posted on by 4
Hi,
 
What is the best way to manipulate complex JSON objects?
 
For example I want to update an existing, already posted adaptive card and I want to toggle the visibility of a button based on some action.. I can retrieve the adaptive card using a GetMessageDetails action, but then updating a deeply nested property of the Adaptive Card  is almost impossible to do. The SetProperty function does not allow to provide a path. Instead it offers an overloaded method where you can specific the parent object, but even that I am not able to get that properly working.
 
Below is an oversimplification of the adaptive card I have.
 
How can I easily update the isEnabled property using JSON manipulation where the property is nested inside multiple arrays? 
 
 
{
    "type": "AdaptiveCard",
    "body": [
        {
            "type": "TextBlock",
            "size": "Medium",
            "weight": "Bolder",
            "text": "text test stestes"
        },
        {
            "type": "ColumnSet",
            "columns": [
                {
                    "type": "Column",
                    "width": "auto"
                },
                {
                    "type": "Column",
                    "width": "stretch"
                }
            ]
        },
        {
            "type": "ActionSet",
            "actions": [
                {
                    "type": "Action.Submit",
                    "title": "Acknowledge",
					"isEnabled": true,
                    "data": {
                        "action": "acknowledge",
                        "uid": "uniqueId"
                    }
                },
                {
                    "type": "Action.Submit",
                    "title": "Resolve",
                    "isEnabled": false,
                    "data": {
                        "action": "resolve",
                        "uid": "uniqueId"
                    }
                },
                {
                    "type": "Action.Submit",
                    "title": "Close",
                    "isEnabled": false,
                    "data": {
                        "action": "close",
                        "uid": "uniqueId"
                    }
                }
            ]
        }
    ],
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.6"
}
 
 
 
Categories:
I have the same question (0)
  • SaiRT14 Profile Picture
    1,992 Super User 2025 Season 1 on at
    pls try the following: - javascript arrays can help.
     
    const adaptiveCard = {
      "type": "AdaptiveCard",
      "body": [
        {
          "type": "TextBlock",
          "size": "Medium",
          "weight": "Bolder",
          "text": "text test stestes"
        },
        {
          "type": "ColumnSet",
          "columns": [
            { "type": "Column", "width": "auto" },
            { "type": "Column", "width": "stretch" }
          ]
        },
        {
          "type": "ActionSet",
          "actions": [
            {
              "type": "Action.Submit",
              "title": "Acknowledge",
              "isEnabled": true,
              "data": { "action": "acknowledge", "uid": "uniqueId" }
            },
            {
              "type": "Action.Submit",
              "title": "Resolve",
              "isEnabled": false,
              "data": { "action": "resolve", "uid": "uniqueId" }
            },
            {
              "type": "Action.Submit",
              "title": "Close",
              "isEnabled": false,
              "data": { "action": "close", "uid": "uniqueId" }
            }
          ]
        }
      ],
      "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
      "version": "1.6"
    };
    // Function to update `isEnabled` for a specific action
    function updateIsEnabled(card, actionTitle, newState) {
      const actionSet = card.body.find(item => item.type === "ActionSet");
      if (actionSet) {
        const action = actionSet.actions.find(a => a.title === actionTitle);
        if (action) {
          action.isEnabled = newState;
        }
      }
    }
    // Example: Toggle "Acknowledge" button to disabled
    updateIsEnabled(adaptiveCard, "Acknowledge", false);
    console.log(JSON.stringify(adaptiveCard, null, 2));
     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 223

#2
David_MA Profile Picture

David_MA 210 Super User 2026 Season 1

#3
Haque Profile Picture

Haque 175

Last 30 days Overall leaderboard