Get specific values from OData JSON Object in Flow Designer Action Script Step

Dominik von Fi1
Mega Expert

Hello All,

I've created a flow designer action that gets me devices from the microsoft intune graph API. I get the expected result, but I am unable to extract specific values from the response body.

The script step to get the value "id" from the JSON object looks like this:

find_real_file.png

 

However, this does not get me any output value:

find_real_file.png

 

I think it has something to do with the JSON object being an "OData" Object, because if I test the script step with the response body cut off of these @odata.context values (and therefore having a "normal" JSON object, it works.

Here is how the JSON Response body looks like (I removed some value pairs for readability):

 

{
  "@odata.context":"https://graph.microsoft.com/v1.0/$metadata#deviceManagement/managedDevices",
  "@odata.count":1,
  "value":[
     {
        "id":"xxx-xxx",
        "userId":"yyy-yyy",
        "deviceName":"X",
        "managedDeviceOwnerType":"company",
        "enrolledDateTime":"2020-04-22T05:27:38Z",
        "lastSyncDateTime":"2020-07-23T14:01:21Z",
        "operatingSystem":"Windows",
        "complianceState":"compliant",
        "jailBroken":"Unknown",
        "managementAgent":"configurationManagerClientMdm",
        "osVersion":"10.0.18363.959",
        
        "deviceActionResults":[

        ],
        "configurationManagerClientEnabledFeatures":{
           "inventory":true,
           "modernApps":true,
           "resourceAccess":true,
           "deviceConfiguration":true,
           "compliancePolicy":true,
           "windowsUpdateForBusiness":true
        }
     }
  ]
}

 

How can I get specific values from this response body? E.g. "id" oder "deviceName"?

 

Thanks!

1 ACCEPTED SOLUTION

Deepen Shah
Kilo Guru

Hi

Instead 'responseObject.id' in script try following,

responseObject.value[0].id; and same for devicename. You need to follow the correct path as 'id' reside inside 'value'.


Please mark correct & helpful if that works.

Regards
Deepen shah
aavenir.com

 

View solution in original post

3 REPLIES 3

Deepen Shah
Kilo Guru

Hi

Instead 'responseObject.id' in script try following,

responseObject.value[0].id; and same for devicename. You need to follow the correct path as 'id' reside inside 'value'.


Please mark correct & helpful if that works.

Regards
Deepen shah
aavenir.com

 

Perfect, thanks!

Hi Deepen,

 

Can you please tell me how to call '@odate.count' in script . Like responseObject.value[0].id;