
Announcements
Hello community,
I am building a Power Automate that takes a json object as input - see below
[
[
"Row 1 ID value",
"Row 1 Name value",
"Row 1 link value",
"Row 1 Comments value"
],
[
"Row 2 ID value",
"Row 2 Name value",
"Row 2 link value",
"Row 2 Comments value"
],
.
.
.
[
"Row n ID value",
"Row n Name value",
"Row n link value",
"Row n Comments value"
]
]
I need to process that input to get specific values "per row" say at positions 0 (which happens to have the row's ID value) and 2 (which happens to have the row's link value), so the output object would look like:
[
[
"Row 1 ID value",
"Row 1 link value",
],
[
"Row 2 ID value",
"Row 2 link value",
],
.
.
.
[
"Row n ID value",
"Row n link value",
]
]
In the real scenario, the input and output objects will have more "values per row", so I will need to hardcode the positions I am taking from the input to the output object.
Is there a simple way to achieve this?
Hi @IPLO365
Here is the sample flow. Assuming the order of elements are same in each row element.
I have stored input array in the compose action:
[
[
"Row 1 ID value",
"Row 1 Name value",
"Row 1 link value",
"Row 1 Comments value"
],
[
"Row 2 ID value",
"Row 2 Name value",
"Row 2 link value",
"Row 2 Comments value"
],
[
"Row n ID value",
"Row n Name value",
"Row n link value",
"Row n Comments value"
]
]
Next, add select action. Pass the output of compose action in 'From' parameter:
Click "Switch Map to text mode" button and enter an expression to get the desired output:
Below expression needs to be added in the expression box as shown below:
createArray(item()[0],item()[2])
The output body of select action will give the required array.
Output:
If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.