
Announcements
Hi, I need the choices in an adaptive card (in Teams) to be dynamic, taken from a person field in a SharePoint document library.
Once I have retrieved the item properties I am appending the details I need, formatted as a block of JSON, to an array variable within an 'Apply to each' action. After the action completes I need to create a single continuous block of JSON from the array variable content for use in my adaptive card JSON.
The append to the array variable appears to work as needed, formatting the data as a single option block of JSON.
However, outside of the 'Apply to each' action, when I use a simple Compose action in an attempt to create a single continuous block of JSON, I get straight brackets at each end and all line breaks and spaces have been replaced with '\n\', or a combination.
I tried using the compose in my adaptive card JSON but it fails to be recognised as correct syntax JSON and so no options are presented in the card.
How can I create a single, correctly formatted JSON block from multiple items from a list?
Hi, I resolved my problem.
The trick was to convert the array variable content into a string (using the 'string' expression) and then use a series of replace actions to remove the special characters. I created a 'new line' variable to inject a new line, replacing certain special characters that had been injected during the creation of the array.
In the end the compose action expressions looks like this: