Tray Embedded / Advanced Topics / Data Mapping (Embedded) / Mapping nested data

Mapping nested data

In the hardcoded example it is likely that we would also want to map the 'country' for the customer.

The problem here is that, if we look at the output from the Stripe 'List Accounts' operation we can see that 'country' is nested in the address object for each customer:

Creating an object to extract the nested values

In this example, we are wanting to make use of the country field for each Stripe account. An inspection of the output log for a Stripe account shows that it is nested within an address object:

So we can surface the field using an object helper and the $.steps.loop-1.value.shipping.address.country jsonpath:

This pulls in all desired fields so the mapping script can access them using only the object helpers step.