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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Parse Json returning N...
Power Automate
Unanswered

Parse Json returning Null on apply to each loop on custom connector

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I am currently working on a custom connector to retrieve unified audit log files and save in a custom list, the custom connector has been successfully created and tested, i want to be able to use the custom connector on my tenant, i have created a flow which i was able to get the REST payload from the custom connector (using Parse json Action), but upon trying to apply the payload on a Apply to Each loop, it fails with the follwoing error message:

 

ExpressionEvaluationFailed. The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression '@body('Parse_JSON')?['value']' is of type 'Null'. The result must be a validarray.

 

json body.JPG

 

I want to be able to loop through the payload and save individual items to a custom sharepoint list using the Apply to Each Loop. Any assistance will be appreciated.

Categories:
I have the same question (0)
  • v-bacao-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

    If it is convenient, would you please provide sample data for response? This way we can do some targeted tests to analyze the problem.

    The first thing I noticed is that what you fill in Content seems to be xml type data. Parse JSON action is generally used to parse JSON response. This is the point I care about.

    In addition, in Apply to each, it is an array that needs to be traversed. It seems that there is no array of data in Content.

    Please provide more details and we would provide proper workaround.

     

    Best Regards,

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @v-bacao-msft 

     

    Thanks for your reply. Below is the output of the Parse Json Action:

    {
     "?xml": {
     "@version": "1.0",
     "@encoding": "utf-8"
     },
     "feed": {
     "@xml:base": "https://outlook.office365.com/Psws/Service.svc/",
     "@xmlns": "http://www.w3.org/2005/Atom",
     "@xmlns:d": "http://schemas.microsoft.com/ado/2007/08/dataservices",
     "@xmlns:m": "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata",
     "id": "https://outlook.office365.com/psws/service.svc/UnifiedAuditLog",
     "title": {
     "@type": "text",
     "#text": "UnifiedAuditLog"
     },
     "updated": "2019-06-05T14:38:23Z",
     "link": {
     "@rel": "self",
     "@title": "UnifiedAuditLog",
     "@href": "UnifiedAuditLog"
     },
     "entry": [
     {
     "id": "https://outlook.office365.com/Psws/Service.svc/UnifiedAuditLog('f17b552b-fe5b-47d4-4793-08d6d947dc75')",
     "category": {
     "@term": "Exchange.UnifiedAuditLog",
     "@scheme": "http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"
     },
     "link": {
     "@rel": "edit",
     "@title": "UnifiedAuditLog",
     "@href": "UnifiedAuditLog('f17b552b-fe5b-47d4-4793-08d6d947dc75')"
     },
     "title": null,
     "updated": "2019-06-05T14:38:23Z",
     "author": {
     "name": null
     },
     "content": {
     "@type": "application/xml",
     "m:properties": {
     "d:Identity": "f17b552b-fe5b-47d4-4793-08d6d947dc75",
     "d:AuditData": "{\"CreationTime\":\"2019-05-15T15:13:18\",\"Id\":\"f17b552b-fe5b-47d4-4793-08d6d947dc75\",\"Operation\":\"SearchQueryPerformed\",\"OrganizationId\":\"078acfbb-b49d-4b91-88a0-07e87e9d70b8\",\"RecordType\":4,\"UserKey\":\"i:0h.f|membership|xxx@live.com\",\"UserType\":0,\"Version\":1,\"Workload\":\"SharePoint\",\"ClientIP\":\"xxx\",\"ObjectId\":\"aee3dc9e-f030-0000-98cf-806886572c03\",\"UserId\":\"xxx@binalog.onmicrosoft.com\",\"CorrelationId\":\"aee3dc9e-f030-0000-98cf-806886572c03\",\"EventSource\":\"SharePoint\",\"ItemType\":\"Web\",\"UserAgent\":\"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/74.0.3729.131 Safari\\/537.36\",\"EventData\":\"<ClientType>OneDriveWeb<\\/ClientType>\"}",
     "d:CreationDate": {
     "@m:type": "Edm.DateTime",
     "#text": "2019-05-15T15:13:18Z"
     },
     "d:IsValid": {
     "@m:type": "Edm.Boolean",
     "#text": "true"
     },
     "d:ObjectState": "Unchanged",
     "d:Operations": "SearchQueryPerformed",
     "d:RecordType": "SharePoint",
     "d:ResultCount": {
     "@m:type": "Edm.Int32",
     "#text": "72"
     },
     "d:ResultIndex": {
     "@m:type": "Edm.Int32",
     "#text": "1"
     },
     "d:UserIds": "xxx@binalog.onmicrosoft.com",
     "d:ObjectIds": {
     "@m:null": "true"
     },
     "d:IPAddresses": {
     "@m:null": "true"
     },
     "d:SiteIds": {
     "@m:null": "true"
     }
     }
     }
     },
     {
     "id": "https://outlook.office365.com/Psws/Service.svc/UnifiedAuditLog('e832ee13-1122-4461-f299-08d6d947da59')",
     "category": {
     "@term": "Exchange.UnifiedAuditLog",
     "@scheme": "http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"
     },
     "link": {
     "@rel": "edit",
     "@title": "UnifiedAuditLog",
     "@href": "UnifiedAuditLog('e832ee13-1122-4461-f299-08d6d947da59')"
     },
     "title": null,
     "updated": "2019-06-05T14:38:23Z",
     "author": {
     "name": null
     },
     "content": {
     "@type": "application/xml",
     "m:properties": {
     "d:Identity": "e832ee13-1122-4461-f299-08d6d947da59",
     "d:AuditData": "{\"CreationTime\":\"2019-05-15T15:13:14\",\"Id\":\"e832ee13-1122-4461-f299-08d6d947da59\",\"Operation\":\"SearchQueryPerformed\",\"OrganizationId\":\"078acfbb-b49d-4b91-88a0-07e87e9d70b8\",\"RecordType\":4,\"UserKey\":\"i:0h.f|membership|xxx@live.com\",\"UserType\":0,\"Version\":1,\"Workload\":\"SharePoint\",\"ClientIP\":\"41xxx\",\"ObjectId\":\"ade3dc9e-b061-0000-66aa-7f4496cf37a6\",\"UserId\":\"xxx@binalog.onmicrosoft.com\",\"CorrelationId\":\"ade3dc9e-b061-0000-66aa-7f4496cf37a6\",\"EventSource\":\"SharePoint\",\"ItemType\":\"Web\",\"UserAgent\":\"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/74.0.3729.131 Safari\\/537.36\",\"EventData\":\"<ClientType>OneDriveWeb<\\/ClientType>\"}",
     "d:CreationDate": {
     "@m:type": "Edm.DateTime",
     "#text": "2019-05-15T15:13:14Z"
     },
     "d:IsValid": {
     "@m:type": "Edm.Boolean",
     "#text": "true"
     },
     "d:ObjectState": "Unchanged",
     "d:Operations": "SearchQueryPerformed",
     "d:RecordType": "SharePoint",
     "d:ResultCount": {
     "@m:type": "Edm.Int32",
     "#text": "72"
     },
     "d:ResultIndex": {
     "@m:type": "Edm.Int32",
     "#text": "2"
     },
     "d:UserIds": "xxx@binalog.onmicrosoft.com",
     "d:ObjectIds": {
     "@m:null": "true"
     },
     "d:IPAddresses": {
     "@m:null": "true"
     },
     "d:SiteIds": {
     "@m:null": "true"
     }
     }
     }
     }
     ]
     }
    }

     

    The conten type is still in xml after i have tried converting to json using: 

    json(body('GetLog')) in the parse json content field, i thought this would have done the conversion. Further assistance will be appreciated
  • v-bacao-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

    From the Data sample you provide, it seems that only the contents of entry property can be traversed in Apply to each.

    23.PNG

    Apply to each requires an output of type array, and the Expression populated in Parse JSON doesn't seem to get anything.

     

    Best Regards,

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @v-bacao-msft ,

     

    Please i do i make it work, i am following a tutorial i found on microsoft flow site, site url: https://flow.microsoft.com/en-us/blog/custom-connector-microsoft-flow-search-unified-audit-log/ 

     

    but the steps in the tutorial donot seem to work. i will appreciate further assistance.

     

  • v-bacao-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

     

    The comment below the blog seems to mention a situation similar to yours, please check if it helps you.

     

    Best Regards,

  • MattWeston365 Profile Picture
    1,701 on at

    Hi @Anonymous , was the guidance by @v-bacao-msft useful to your resolving your issue? If so, could you please mark the relevant post as the solution so that others with the same issue can quickly resolve it.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 386

#2
Valantis Profile Picture

Valantis 342

#3
Haque Profile Picture

Haque 336

Last 30 days Overall leaderboard