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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / error when using the o...
Power Automate
Unanswered

error when using the outputs from parse json

(1) ShareShare
ReportReport
Posted on by 304

Hi everyone,

I'm trying to get some data from an API via http action and then put that data into a sharepoint list. 

So far, the http action returns the correct data and my next step is to put the body from the output into a parse json action (schema is from a former run) so I can use it in a create element action (which is inside a apply to each loop). Unfortunately, the flow always fails at the loop with the following error:

The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression '@body('parse_JSON')?['body']?['items']' is of type 'Null'. The result must be a valid array.

 

I checked the inputs and outputs for the parse json action and there is data in it. So I don't get why the loop gets no data? 

I'll show you some screenshots below.

The inputs

LisKr_0-1720679418003.png

 

The outputs:

LisKr_1-1720679557271.png

 

The schema:

Spoiler (Highlight to read)
 
 
{
 "type": "object",
 "properties": {
 "statusCode": {
 "type": "integer"
 },
 "headers": {
 "type": "object",
 "properties": {
 "Date": {
 "type": "string"
 },
 "Connection": {
 "type": "string"
 },
 "Access-Control-Expose-Headers": {
 "type": "string"
 },
 "Cache-Control": {
 "type": "string"
 },
 "Pragma": {
 "type": "string"
 },
 "Set-Cookie": {
 "type": "string"
 },
 "Vary": {
 "type": "string"
 },
 "X-AspNet-Version": {
 "type": "string"
 },
 "Request-Context": {
 "type": "string"
 },
 "X-Powered-By": {
 "type": "string"
 },
 "CF-Cache-Status": {
 "type": "string"
 },
 "Server": {
 "type": "string"
 },
 "CF-RAY": {
 "type": "string"
 },
 "Content-Type": {
 "type": "string"
 },
 "Content-Length": {
 "type": "string"
 },
 "Expires": {
 "type": "string"
 }
 }
 },
 "body": {
 "type": "object",
 "properties": {
 "page": {
 "type": "integer"
 },
 "itemsInPage": {
 "type": "integer"
 },
 "totalPages": {
 "type": "integer"
 },
 "prevLink": {
 "type": "string"
 },
 "nextLink": {
 "type": "string"
 },
 "items": {
 "type": "array",
 "items": {
 "type": "object",
 "properties": {
 "TicketID": {
 "type": "integer"
 },
 "TicketTitle": {
 "type": "string"
 },
 "TicketNumber": {
 "type": "string"
 },
 "TicketPriority": {
 "type": "string"
 },
 "TicketImpact": {
 "type": "string"
 },
 "TicketStatus": {
 "type": "string"
 },
 "TicketSource": {
 "type": "string"
 },
 "TicketType": {
 "type": "string"
 },
 "EndUserID": {
 "type": "integer"
 },
 "EndUserEmail": {
 "type": "string"
 },
 "EndUserFirstName": {
 "type": "string"
 },
 "EndUserLastName": {
 "type": "string"
 },
 "EndUserPhone": {
 "type": "string"
 },
 "TicketResolvedDate": {},
 "TicketCreatedDate": {
 "type": "string"
 },
 "TechnicianFirstCommentDate": {
 "type": "string"
 },
 "FirstResponseDueDate": {},
 "ClosedTicketDueDate": {},
 "FirstComment": {
 "type": "string"
 },
 "LastEndUserComment": {
 "type": "string"
 },
 "LastEndUserCommentTimestamp": {
 "type": "string"
 },
 "LastTechnicianComment": {
 "type": "string"
 },
 "LastTechnicianCommentTimestamp": {
 "type": "string"
 },
 "OnSiteDurationSeconds": {
 "type": "integer"
 },
 "OnSiteDurationMinutes": {
 "type": "integer"
 },
 "OffSiteDurationSeconds": {
 "type": "integer"
 },
 "OffSiteDurationMinutes": {
 "type": "integer"
 },
 "OnSLADurationSeconds": {
 "type": "integer"
 },
 "OnSLADurationMinutes": {
 "type": "integer"
 },
 "OffSLADurationSeconds": {
 "type": "integer"
 },
 "OffSLADurationMinutes": {
 "type": "integer"
 },
 "TotalDurationSeconds": {
 "type": "integer"
 },
 "TotalDurationMinutes": {
 "type": "integer"
 },
 "CustomerID": {
 "type": "integer"
 },
 "CustomerName": {
 "type": "string"
 },
 "CustomerBusinessNumber": {},
 "TechnicianContactID": {
 "type": "integer"
 },
 "TechnicianFullName": {
 "type": "string"
 },
 "TechnicianEmail": {
 "type": "string"
 },
 "ContractID": {
 "type": "integer"
 }
 },
 "required": [
 "TicketID",
 "TicketTitle",
 "TicketNumber",
 "TicketPriority",
 "TicketImpact",
 "TicketStatus",
 "TicketSource",
 "TicketType",
 "EndUserID",
 "EndUserEmail",
 "EndUserFirstName",
 "EndUserLastName",
 "EndUserPhone",
 "TicketResolvedDate",
 "TicketCreatedDate",
 "TechnicianFirstCommentDate",
 "FirstResponseDueDate",
 "ClosedTicketDueDate",
 "FirstComment",
 "LastEndUserComment",
 "LastEndUserCommentTimestamp",
 "LastTechnicianComment",
 "LastTechnicianCommentTimestamp",
 "OnSiteDurationSeconds",
 "OnSiteDurationMinutes",
 "OffSiteDurationSeconds",
 "OffSiteDurationMinutes",
 "OnSLADurationSeconds",
 "OnSLADurationMinutes",
 "OffSLADurationSeconds",
 "OffSLADurationMinutes",
 "TotalDurationSeconds",
 "TotalDurationMinutes",
 "CustomerID",
 "CustomerName",
 "CustomerBusinessNumber",
 "TechnicianContactID",
 "TechnicianFullName",
 "TechnicianEmail",
 "ContractID"
 ]
 }
 },
 "totalItemCount": {
 "type": "integer"
 }
 }
 }
 }
}
Categories:
I have the same question (0)
  • ManishSolanki Profile Picture
    15,091 Super User 2025 Season 2 on at

    Hi @LisKr 

     

    Pls try adding below expression in "Apply to each" action or loop to iterate items object:

    @body('parse_JSON')?['items']

     

     

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

  • LisKr Profile Picture
    304 on at

    Hi @ManishSolanki 

    thank you for your reply. I tested your suggestion and now I get an error at the parse json step saying 'the schema validation failed'. I tried re-adding the schema from the http output, but that doesn't help either.

  • ManishSolanki Profile Picture
    15,091 Super User 2025 Season 2 on at

    Hi,

     

    Pls share screenshot(s) of entire flow in edit mode. Also, share the error details with screenshot.

     

     

  • LisKr Profile Picture
    304 on at

    Sure. The flow:

     

    LisKr_4-1720699896265.png

     

    LisKr_1-1720699266573.png

     

    The error:

    LisKr_2-1720699325751.png

    LisKr_3-1720699343430.png

     

     

  • ManishSolanki Profile Picture
    15,091 Super User 2025 Season 2 on at

    Hi,

     

    Pls mask API key in the screenshot as it is sensitive.

     

  • LisKr Profile Picture
    304 on at

    Oh, totally overlooked it. Done now

  • ManishSolanki Profile Picture
    15,091 Super User 2025 Season 2 on at

    Have you modified the input of "Parse JSON" action?

     

     

     

  • LisKr Profile Picture
    304 on at

    No. After it failed, I tried re-adding the whole action completely, but nothing changed. The input is still the output of the http action

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard