Let’s say we have a logic app which gets some data in JSON and some of the data is in array{
"Name": "TestAPP",
"Detectors": [{
"@objectType": "Detector",
"Name": "",
"DetectorType": {
"@objectType": "DetectorType",
"Name": "Smoke"
},
"DetectorExpiryDate": "2024-10-14T10:36:00",
"DetectorResults": {
"@objectType": "PassFail",
"Name": "Pass"
},
"DetectorLocation": {
"@objectType": "Position",
"Name": "Hall"
}
}]
}
In this example we have Name at the top and then Detectors in array data.
In Logic App we will use For each control (action).
Once we have data, sometimes its really hard to to figure out how to get required attribute value from the loop.
To make it simple, you can go to Code view and look for foreach part, and then amend “value” part of the code to something link below@items('For_each')?['DetectorLocation']?['Name']
In above case from items (loop) we are getting item by the name of DetectorLocation and inside that we have an other element called Name we need to get. Your final code should look like below
Hope this helps