Step 1: Parse the results

To parse the results:

  1. In Admin Console, go to Workflow > Workflows console.
  2. In Workflows console, open the Flow that you created for Amazon Petstore.

  3. Scroll to the end of the Run When TRUE cards, and then click Add Another > Function > Text > Compose.

  4. In the Compose card, enter statusCode is and then drag and drop the Outputs statusCode field.

  5. Click Add Another > Function > JSON > Parse.

  6. Drag and drop the Outputs body field to the string field of the Parse card.

  7. In the Parse card, change the name of the output field to parsedString.

Note: type is an object.

  1. Click Add Another > Function > Object > Get Multiple.

  2. Drag and drop the parsedString field from the Parse card to the object field of the Get Multiple card.

  3. In the Get Multiple card, create three output fields: 0.id, 0.type, and 0.price.

  4. Click Add Another > Function > JSON > Parse.

  5. Drag and drop the input string field (of the JSON Parse card from step 6) to the string field of this Parse card.

Note: You can drag and drop inputs from one card to another. Workflows ensures that those inputs will map back to the same source.

  1. In this Parse card, changed the name of the output field to parsedListOfObjects.

  2. Change the type of output field to List of Objects.

Note: If you don’t change the field type, then you won’t be able to map it to the input field of the List Pluck card in the next step. Compare to step 7.

  1. Click Add Another > Function > List > Pluck.

  2. Drag and drop the parsedListOfObjects field from the Parse card to the List field of the Pluck card.

Note: The List Pluck card needs a list of objects. If you map to the output of the JSON Parse card from step 7, an error will occur. This is an update to the steps taken in the video.

  1. In the key field of the Pluck card, enter price.

  2. Click Add Another > Function > List > Flatten.

  3. Drag and drop the parsedString field from the Parse card to the lists field of the Flatten card.

  4. In the output list fields of the Flatten card, enter id, type, and price.

  5. Save your Flow.

Next

Step 2: Add a child Flow