Home / 

ChangelogNovember 30, 2021


Mappings: support for functions when setting Looping Context

In many mapping scenarios, a source document might contain one or more JSON arrays. In order to map an array like that to a different array on the target document, you need to specify a looping context (see Mapping Loops).

Previously, you could only loop over all items on the source array and map each item, but it was not possible to change the order of the array elements or exclude certain array items from the result.

Today, we are adding support for JSONata functions usage when setting a Looping Context. With the support from $filter, $sort, $reverse, and other functions you should be able to translate an array of any shape to the desired format.

For example, assuming that the orders below are coming in a random sorting order, you can adjust that order and sort the result by orderDate before mapping them to shipments:

functions-in-looping-ctx-example