Extraction from JSON file

Hello,

I’m extracting data from an API. Each json file contains one json object. In that json object there’re different values some of them in an array.
To get the data from the array, tktnumber, I’m using the for each activity and then the assign activity (like the picture below) however, the result in only one tkt number from the array and not all of them. Any ideas of what I’m doing wrong?

image

Hi @icosinga

This is happening because you are only using one variable and assigning it with each new item that is processed from the JSON.

Hope this helps!

Right, because I only want to see the tktnumber. But I want to see all the tktnumbers within the array. Does that make sense?

So, you need to create a array of particular length before for each activity. Then you need to add each value into array using assign activity and into dynamic index

  1. Create a variable as count to give the dynamic range and increase its value with 1 everytime in the for each activityy

  2. when the loop comes in, assign as

array(count) = item(“number”).tostring

1 Like

It works! Thank you!

Guys, Here is a detailed article on that :slight_smile: