Accessing and parsing a JSON array
A JSON array is used to store a sequence of data of the same type. This may be a string of numbers or text, for example:
[2,4,6,8,10]
Alternatively, it may look like this:
["John Smith", "Robert Lowe", "Victor Fisher", "Sarah Sutton", "Julie Evans"]
The problem here is that you have a set of data and in the case of the names above, each of these may be the name of a contact you wish to add to your enterprise system. To do this, you need to take each name in turn and perform the same action (the act of creating a contact and adding the name into it). To do this, we use the ForEach loop to process each name separately.
However, there is a problem.
When the logic app reads the array variable that stores the whole array, such as if we named the logic app variable myArray
, the entire array is presented, not each component name. To clarify this, we see all the names presented as one item...