The solution for this challenge involves parsing the JSON string, iterating over the array of user accounts, and extracting info from the nested data structures.
Download the solution.dfl (20.3 KB) file to follow along.
Step 1: Parsing
The HTTP step is a good place to parse the HTTP repsonse string to JSON, and placing it into the row stream. The JSON object becomes a corresponding tweakflow data value.
Step 2: Iterating over accounts
The Get Items step emits each item contained in json[:results]
into the row stream, giving us individual user dicts to work on.
Step 3: Extracting user data
Now that we have individual users to work on, we can extract user data by accessing the corresponding keys. Note that foo[:key_1, :key_2]
is a shorthand for foo[:key_1][:key_2]
,allowing slightly more compact notation for consecutive key access.
Step 4: Cleanup
The solution uses the Pick Fields step to remove the json
and user
objects from the row stream.
The final result
The row stream contains the data as required: