Skip to main content

Notifications

Community site session details

Community site session details

Session Id : ENaZtvqQ18enB+jWyS0FLB
Power Automate - Building Flows
Unanswered

Parse JSON from a HTTP GET request

Like (0) ShareShare
ReportReport
Posted on 30 Nov 2022 09:44:26 by 4

I'm working with a client that needs automatic reporting on per user licensing based on groups, this can be obtained manually but Automaticaly is causing me a head ache

 

So far I have designed a flow that pulls the users in a group from AAD and once its done that it checks each user against the MS graph   https://graph.microsoft.com/v1.0/users/@{items('Apply_to_each')?['id']}/licenseDetails

 

this element works fine, and Almost gives me what I need, the problem is it response in a JSON format with firstly allot more info than is needed but also in information that needs correlating.. (license type would appear as the below), this is a snip from the response. 

 

            "id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
            "skuId": "71f21848-f89b-4aaa-a2dc-780c8e8aac5b",
            "skuPartNumber": "CPC_B_2C_8RAM_128GB",
            "servicePlans": [
                {
                    "servicePlanId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
                    "servicePlanName": "M365_LIGHTHOUSE_PARTNER_PLAN1",
                    "provisioningStatus": "Success",
                    "appliesTo": "Company"
 
I have tried to use Parse JSON to allow me to retreieve the skuID and then using the below Schema but this fire out this error when I try 
 
InvalidJSON. The 'content' property of actions of type 'ParseJson' must be valid JSON. The provided value cannot be parsed: 'Unexpected character encountered while parsing value: L. Path '', line 0, position 0.'. 
 
{
    "type""object",
    "properties": {
        "@@odata.context": {
            "type""string"
        },
        "value": {
            "type""array",
            "items": {
                "type""object",
                "properties": {
                    "id": {
                        "type""string"
                    },
                    "skuId": {
                        "type""string"
                    },
                    "skuPartNumber": {
                        "type""string"
                    },
                    "servicePlans": {
                        "type""array",
                        "items": {
                            "type""object",
                            "properties": {
                                "servicePlanId": {
                                    "type""string"
                                },
                                "servicePlanName": {
                                    "type""string"
                                },
                                "provisioningStatus": {
                                    "type""string"
                                },
                                "appliesTo": {
                                    "type""string"
                                }
                            },
                            "required": [
                                "servicePlanId",
                                "servicePlanName",
                                "provisioningStatus",
                                "appliesTo"
                            ]
                        }
                    }
                },
                "required": [
                    "id",
                    "skuId",
                    "skuPartNumber",
                    "servicePlans"
                ]
            }
        }
    }
}
 
I need to first of all get the skuID and then I need to compare this against information available on https://learn.microsoft.com/en-us/azure/active-directory/enterprise-users/licensing-service-plan-reference to get the license name but this PARSE JSON doesnt seem to play ball, probably a simple error but hoping any of you could help. 
Categories:
  • dperez13 Profile Picture
    432 on 16 Apr 2024 at 21:27:00
    Re: Parse JSON from a HTTP GET request

    thanks. I got it. i did parse json but power automate automatically suggest you do something thats wrong. 

     

    iinstead of the correct:

    @body('Parse_JSON')?['value']'

    https://powerusers.microsoft.com/t5/General-Power-Automate/Problem-with-Parse-JSON-is-of-type-Null-The-result-must-be-a/m-p/1590157#M92212
    figured it out thanks to @vivekpande18

     
  • dperez13 Profile Picture
    432 on 16 Apr 2024 at 21:21:08
    Re: Parse JSON from a HTTP GET request

    i cant loop over body parse json as its type object, and when i try to loop over body parse json [value] i get that its null

  • dperez13 Profile Picture
    432 on 16 Apr 2024 at 20:48:28
    Re: Parse JSON from a HTTP GET request

    i cant get that to work. any tips

  • VictorIvanidze Profile Picture
    12,214 on 16 Apr 2024 at 20:32:37
    Re: Parse JSON from a HTTP GET request

    Parsing the JSON is your only way.

  • dperez13 Profile Picture
    432 on 16 Apr 2024 at 20:26:18
    Re: Parse JSON from a HTTP GET request

    messages?$filter=flag/flagStatus eq 'Complete' this works in send an http request

     

    this does NOT work in the get emails v3 search query/search filter property

     

    the problem is i do not know how to work with the 'send an http request' from outlook activity as the body is not iterable as its an object not an array and parsing the json is too complicated from the schema. 

  • VictorIvanidze Profile Picture
    12,214 on 16 Apr 2024 at 20:21:17
    Re: Parse JSON from a HTTP GET request

    Could you share the request?

  • dperez13 Profile Picture
    432 on 16 Apr 2024 at 20:14:20
    Re: Parse JSON from a HTTP GET request

    how do i use apply to each from the body payload of outlook send an http request. parse json too complicated. i pasted in the schema and i get   schema validation failed and when i try to loop over the body of send an http request for outlook emails i get its an object and not an array so i cant apply to each it. 

     

    please help

    i want to fetch/get all emails in outlook that have flag status eq is completed (green checkmark)

  • VictorIvanidze Profile Picture
    12,214 on 01 Dec 2022 at 13:05:28
    Re: Parse JSON from a HTTP GET request

    Hi @AaronM-C,

    could you please confirm this works for you:

    VictorIvanidze_0-1669899684893.png

     

     

  • AaronM-C Profile Picture
    4 on 01 Dec 2022 at 12:55:49
    Re: Parse JSON from a HTTP GET request

    Unfortunately that didnt work, MS graph refused the body request
    I managed to get a workaround though

    AaronMC_0-1669899125828.png

     

    AaronMC_1-1669899157375.png

    AaronMC_2-1669899184163.png

     

     

     

  • VictorIvanidze Profile Picture
    12,214 on 01 Dec 2022 at 12:48:51
    Re: Parse JSON from a HTTP GET request

    Hi @AaronM-C,

    any comments? 

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,765 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,091 Most Valuable Professional

Leaderboard
Loading started