cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AnkitShah55
Helper IV
Helper IV

Initialize variable from JSON, need help

Hello,

 

I need to get "id" parameter as a variable(Initialize Variable) from following JSON output of MSFT Graph API. Please help.

"id": "AAMkADxxxxxxxxxxxxxxxxxxNgBGAAAAAAA4KpCwRxxxxxxxxxxxxxxxxxxxxxxxpQQYAAAAN60Axxxxxxxxxxxd4TL0Efpe__dRVAAK5zvX6AAA="

{
    "statusCode": 200,
    "headers": {
        "Transfer-Encoding": "chunked",
        "Vary": "Accept-Encoding",
        "Strict-Transport-Security": "max-age=31536000",
        "request-id": "954b8428-xxx-xxxx-xxxx-27152a497dee",
        "client-request-id": "954b8428-xxx-xxxx-xxxx-27152a497dee",
        "x-ms-ags-diagnostic": "{\"ServerInfo\":{\"DataCenter\":\"South India\",\"Slice\":\"E\",\"Ring\":\"3\",\"ScaleUnit\":\"000\",\"RoleInstance\":\"MA1PExxxxxx12F7\"}}",
        "Timing-Allow-Origin": "*",
        "x-ms-apihub-cached-response": "true",
        "Cache-Control": "private",
        "Date": "Tue, 23 Feb 2021 20:08:09 GMT",
        "Content-Type": "application/json; odata.metadata=minimal; odata.streaming=true; IEEE754Compatible=false; charset=utf-8",
        "Content-Length": "1463"
    },
    "body": {
        "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('1f020274-xxxx-xxxx-xxxx-8bc529c82f91')/mailFolders('SentItems')/messages(id,toRecipients,ccRecipients,from,importance,hasAttachments,subject,createdDateTime,receivedDateTime,internetMessageId,isRead,attachments(size,isInline,lastModifiedDateTime))",
        "value": [
            {
                "@odata.etag": "W/\"Cxxxxxxxxxxxzemcid4TL0Efpe++dRVAAK4f0SL\"",
                "id": "AAMkADxxxxxxxxxxxxxxxxxxNgBGAAAAAAA4KpCwRxxxxxxxxxxxxxxxxxxxxxxxpQQYAAAAN60Axxxxxxxxxxxd4TL0Efpe__dRVAAK5zvX6AAA=",
                "createdDateTime": "2021-02-23T19:39:38Z",
                "receivedDateTime": "2021-02-23T19:41:34Z",
                "hasAttachments": false,
                "internetMessageId": "<PN1PR01xxxxxxxxxxxxB88C1F8809@PN1PR0101MB1517.INDPRD01.PROD.OUTLOOK.COM>",
                "subject": "xxxxxxxxxxxxxxxxxxxxx",
                "importance": "normal",
                "isRead": true,
                "from": {
                    "emailAddress": {
                        "name": "Ankit Shah",
                        "address": "xxxxx@xxxxxxxxx.com"
                    }
                },
                "toRecipients": [
                    {
                        "emailAddress": {
                            "name": "xxx xxx",
                            "address": "xxxx.xxxx@xxxxxxxxxxx.com"
                        }
                    }
                ],
                "ccRecipients": [],
                "attachments": []
            }
        ],
        "@odata.nextLink": "https://graph.microsoft.com/v1.0/me/mailFolders('SentItems')/messages?%24select=Id%2cToRecipients%2cCcRecipients%2cFrom%2cImportance%2cHasAttachments%2cSubject%2cCreatedDateTime%2cReceivedDateTime%2cInternetMessageId%2cIsRead&%24expand=Attachments(%24Select%3dSize%2cIsInline%2cLastModifiedDateTime)&%24top=1&%24skip=1"
    }
}

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Paulie78
Super User III
Super User III

Use this expression:

outputs('JSON')['body']['value'][0]['id']

You will need to adjust it so that outputs('JSON') is changed to whatever you are getting that JSON from.

View solution in original post

5 REPLIES 5
PrasadAthalye
Super User
Super User

Can you use ParseJSON action and use the above JSON to generate Schema? Then use Compose and Id from ParseJSON action?

PrasadAthalye_1-1614118878502.png

 

PrasadAthalye_0-1614118848313.png

 

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community
Paulie78
Super User III
Super User III

Use this expression:

outputs('JSON')['body']['value'][0]['id']

You will need to adjust it so that outputs('JSON') is changed to whatever you are getting that JSON from.

View solution in original post

AnkitShah55
Helper IV
Helper IV

@Paulie78 Thanks, that expression helped me.

 

@PrasadAthalye Thank you, but I am getting error while using the same method you described, please see attached photo.

 

AnkitShah55_0-1614153170072.png

 

PrasadAthalye
Super User
Super User

So did your issue resolve with the solution @Paulie78 provided?

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

Helpful resources

Announcements
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Carousel

Sign up for our May 4th event!

May the fourth be with you, join us online!

MSFTBizAppsLaunchEvent

Experience what’s next for Power Virtual Agents

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (25,532)