Skip to main content

Notifications

Publish & Channel Management
Unanswered

Copilot Studio Parsed Json request

Posted on by 2

Hello everyone, I'm a beginner with Copilot Studio and I could use some advice. I'm making an API request and storing the response in the 'SampleJSON' variable. After that, I attempt to access the property 'Topic.SampleJSON.result[0].number' to display this value in the chat. However, I encounter an error stating that it's not possible. How can I correctly reach the last level of this JSON property that looks like this:

 

{

"result": [

                {

               "number": "string",

             "short_description": "string",

             "close_notes": "string"

                 }

          ]

}

 

EudesBarbosa_0-1706218096605.png

 

  • Leo_Blue Profile Picture
    Leo_Blue 5 on at
    Copilot Studio Parsed Json request
    Not sure if this code worked for you. It threw an error when I used this code.
     
    Index(Topic.resultTable.result,1).close_notes
     
    It worked fine when I tried this way:
    Index(ParseJSON(Topic.resultTable.result),1).close_notes
     
     
  • adilei Profile Picture
    adilei on at
    Re: Copilot Studio Parsed Json request

    Thanks for bringing this to my attention! 

     

    OP's payload is an array nested within an object, or in PowerFX, a table nested within a record:

     

     

    {
     "result": [
     {
     "number": "string",
     "short_description": "string",
     "close_notes": "string"
     }
     ]
    }

     

     


    To access a property on the first record of a table nested within a record, you can use the following pattern:

     

     

     

    Index(Topic.myRecord.result,1).close_notes

     

     







     

     

  • Expiscornovus Profile Picture
    Expiscornovus 1,708 on at
    Re: Copilot Studio Parsed Json request

    Hi @adilei,

     

    Does the Index function actually work with a record data type? Like @EudesBarbosa mentioned the return data is not a table, but a record.

     

    record_datatype.png

  • adilei Profile Picture
    adilei on at
    Re: Copilot Studio Parsed Json request

    Use the PowerFX Index function to access a specific row:

     

    Index(Topic.resultTable.result,1).close_notes

     

Helpful resources

Quick Links

Exciting News for Copilot Studio Communi…

Get ready to experience a whole new level of engagement with the Copilot Studio…

Celebrating the May Super User of the…

LaurensM is an exceptional contributor to the Power Platform Community…

Check out the Copilot Studio Cookbook…

We are excited to announce our new Copilot Cookbook Gallery in the Community…

Leaderboard

#1
renatoromao Profile Picture

renatoromao 6,459

#2
Pstork1 Profile Picture

Pstork1 1,997

#3
Expiscornovus Profile Picture

Expiscornovus 1,708

Leaderboard

Featured topics