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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Copilot Studio / Formatting response fr...
Copilot Studio
Answered

Formatting response from Power Automate in virtual agent

(0) ShareShare
ReportReport
Posted on by 248

Hi does anyone know how to format a response returned to the virtual agent?

 

In Flow I have JSON output that is parsed and I use the "value" from the parse JSON action in the virtual agent response action, however the format is one long JSON string.

[{“id”:“234sodoz-48ff-4ee9-werwe-1edwerewb8dd”,“Name”:“TestName”,“DateTime”:“2018-11-29T23:34:24Z”,“manufacturer”:“Microsoft Corporation”,“model”:“Virtual Machine”,“serialNumber”:“90294”,“operatingSystem”:“Windows”}]

 

I'd like the output for the response to be in a readable format and accommodate for multiple records.  Anyone have ideas?  Ideally I'd like a table, however create CSV and HTML actions in Power Automate don't show correctly in the response either.

 

Categories:
I have the same question (0)
  • CU22081450-0 Profile Picture
    Most Valuable Professional on at

    Hi @cbernier12 ,

     

    You can use Markdown to format results inside the Power Virtual Aggents.

     

    Basically, you need to create a parse JSON action inside the Power Automate, read all properties and format the results inside your workflow.

    After that, you need to create a response to your chatbot using a string property.

     

    I will create a sample, wait some minutes, please.

    But you can read this documentation: Use markdown to format Power Automate approvals - Power Automate | Microsoft Docs

  • CU22081450-0 Profile Picture
    Most Valuable Professional on at

    1.png

     

    2.png

     

    3-.png

  • CU22081450-0 Profile Picture
    Most Valuable Professional on at

    Hi @cbernier12 ,

     

    I posted all steps above.

    You can follow it and if you need to use the PArse Json Schema, you can see my code below:

     

    {
        "type""array",
        "items": {
            "type""object",
            "properties": {
                "id": {
                    "type""string"
                },
                "Name": {
                    "type""string"
                },
                "DateTime": {
                    "type""string"
                },
                "manufacturer": {
                    "type""string"
                },
                "model": {
                    "type""string"
                },
                "serialNumber": {
                    "type""string"
                },
                "operatingSystem": {
                    "type""string"
                }
            },
            "required": [
                "id",
                "Name",
                "DateTime",
                "manufacturer",
                "model",
                "serialNumber",
                "operatingSystem"
            ]
        }
    }
  • Pstork1 Profile Picture
    68,707 Most Valuable Professional on at

    I suspect you are looking for the ability to return an array to PVA the way you can with Power Apps.  That functionality isn't currently available.  As @renatoromao said you need to format your response as text in the Flow and then return it to PVA for display.  You can't return a raw array the way you can when using an HTTP Response to return JSON to Power Apps.  It may be possible in the future, but isn't at this point.

  • cbernier12 Profile Picture
    248 on at

    @renatoromao I tried your example exactly and I receive the following at the parse JSON action:

     

    The 'content' property of actions of type 'ParseJson' must be valid JSON. The provided value cannot be parsed: 'Invalid property identifier character: “. Path '[0]', line 1, position 2.'.

  • cbernier12 Profile Picture
    248 on at

    Actually I'm using a HTTP call that pulls data back and then I parse it with a parse JSON action, in the apply to each action I need to somehow convert the object to an array I guess.  Or will that not work either?

     

    ExpressionEvaluationFailed. The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression '@body('Parse_JSON')' is of type 'Object'. The result must be a valid array.

  • CU22081450-0 Profile Picture
    Most Valuable Professional on at

    HI @cbernier12 ,

     

    If you are using Http request to get data from other API or something like that, you need to confirm which is the return that you are receiving because I used your sample to build this template.

     

    Basically you will use the HTTP body inside the Content field on the Parse JSON action and maintain the same parse that I used. (Maybe you can remove the required property, but it’s not necessary yet before work the read content values).

     

    Can you send a screenshot about your http result?

    And also send the result here (you can remove sensitivity information)

  • cbernier12 Profile Picture
    248 on at

    Hi @renatoromao, yes very familiar with parsing HTTP calls with the parse JSON action, however it needs to be converted to an array not an object which is the default.  I can use select action, however it won't break out the individual values parse JSON does.

  • cbernier12 Profile Picture
    248 on at

    @renatoromao I got it to work, so the output is still one big string only now the headers start and every entry has a | between it.  Pretty much back to where I started.  Is there no way to modify so it shows up in a table like format in the virtual agent?  Returning one record isn't an issue, however when there are multiple records, the response is a mess to read as it's just one long string of data in the UI.

  • Verified answer
    cbernier12 Profile Picture
    248 on at

    Ok, after some testing I figured out how to make a table format.  In the append to string variable stack the values on top of one another, then add a space on top and bottom between each value.  At the very top add some dashes and do the same for the very bottom underneath the last value.  Works really well.

     

    So it will look like this:

     

    ----------------------------------------------

    name

     

    id

     

    model

     

    etc...

    ----------------------------------------------------

     

    If you want you can add the title for each row next to the value if needed.

     

    So Name: namevalue and so on.

     

    @renatoromao @Pstork1 

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Copilot Studio

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 250 Super User 2025 Season 2

#2
Romain The Low-Code Bearded Bear Profile Picture

Romain The Low-Code... 197 Super User 2025 Season 2

#3
S-Venkadesh Profile Picture

S-Venkadesh 103 Moderator

Last 30 days Overall leaderboard