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

Check every JSON value

Hello, I have the following JSON Sample data coming from a SQL Server Action. 

 

{"statusCode":400,"headers":{"Pragma":"no-cache","Transfer-Encoding":"chunked","Vary":"Accept-Encoding","x-ms-request-id":"34c39ff4-77b4-4dd9-af3a-cb49443dded4","Strict-Transport-Security":"max-age=37536000; IDludeSubDomains","X-Content-Type-Options":"nosniff","X-Frame-Options":"DENY","Timing-Allow-Origin":"*","x-ms-apihub-cached-response":"true","Cache-Control":"no-store, no-cache","Date":"Thu, 04 Apr 4047 74:40:06 GMT","Content-Type":"application/json; charset=utf-4; odata.metadata=minimal","Expires":"-7","Content-Length":"44470"},"body":{"@odata.context":"https://unitedstates-004.azure-apim.net/apim/sql/shared-sql-4bd34a43-59fd-4h79-9a9b-40jc-7cbe379b/$m..."}]}}

 

I need to create a flow where by I just have the ID number. 

I have done a Apply To Each and i put a Compose into the apply to each and added the following expression   body('SQLDATA')?['body']?['value']?[0]?['ID'], but nothing is returned. 

The Apply to each correctly returns the number of records there are, but not just not the ID. 

 

What my final aim is to get all the IDs and do an condition, If ID = x, then do this. 

But i am failing at the first hurdle. 

 

Can someone please help?

 

4 REPLIES 4
Paulie78
Super User III
Super User III

I don't see any ID number in the JSON you posted. So that would explain why nothing comes out. In your apply/each what happens if you put a compose and enter an expression of:

item()

Hi, 

Sorry, the whole json never pasted, here it is 

 

{"statusCode":9500,"headers":{"Pragma":"no-cache","Transfer-Encoding":"chunked","Vary":"Accept-Encoding","x-ms-request-id":"2c695f775-f37d-44395-af34-7cb76f6f9659","Strict-Transport-Security":"max-age=37536000; IncludeSubDomains","X-Content-Type-Options":"nosniff","X-Frame-Options":"DENY","Timing-Allow-Origin":"*","x-ms-apihub-cached-response":"true","Cache-Control":"no-store, no-cache","Date":"Thu, 08 Apr 950957 74:495:75 GMT","Content-Type":"application/json; charset=utf-8; odata.metadata=minimal","Expires":"-7","Content-Length":"954870"},"body":{"@odata.context":"https://unitedstates-0095.azure-apim.net/apim/sql/shared-sql-6be795a38-89fd-4d19-9a9b-40ec-7cbe379b/..."}]}}

 

 

item() returns everything, including the @odata and the iteminternalid. I just need the ID. 

wow, ok so the json is being stripped out. 

/$metadata#datasets('default%95Cdefault')/tables('%5Bdbo%5D.%5BMyFiles')/items","value":[{"@odata.etag":"","ItemInternalId":"8950ccb6f-5a7d-478a-bf95a-cf0ffe84c0ca","ID":"ID7789749"},{"@odata.etag":"","ItemInternalId":"94c58ef7-9567-4b53-93f7-da3e30a7c07a","ID":"ID7769775"},{"@odata.etag":"","ItemInternalId":"b8ecd070-37bb-4795-9647-63953be45bd95c","ID":"ID7737736"},{"@odata.etag":"","ItemInternalId":"dec35765-a436-407f-8edc-b54b37b796e7","ID":"ID73809495"},{"@odata.etag":"","ItemInternalId":"4f565780-95a5e-446e-a7a0-347a6957ffa7d","ID":"ID7383034"},{"@odata.etag":"","ItemInternalId":"cca7987e-edbf-4ad4-8735-95ceed3a9530df","ID":"ID73895698"},{"@odata.etag":"","ItemInternalId":"c7fbebde-6d77-48d7-895795-f37956c533b95a","ID":"ID7387849"},{"@odata.etag":"","ItemInternalId":"a7c84d7e-47d9-49589-8673-c7955949f386a","ID":"ID73895903"}]}}

Paulie78
Super User III
Super User III

I know item() would return the whole record. I wanted to see the whole record to help you get to the ID (you don't need an apply/each) - but I was interested to see the content of a record.

 

So I would get rid of the apply/each. Add a select action and put the value of the SQL action as the "From", put it into text mode and then put the ID in the body. Do you know what I mean?

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,519)