JSONata filter array of strings

Sometimes JSONata is so hard to understand...

how can i filter the string from the array that contains "bara" ?


Assuming that array is in msg.payload, the following will return an array that only contains the values that include the text bara

 $filter($.payload, function($v) {
   $contains($v, 'bara')
1 Like

Or without calling the filter function and to return an array even if single item found Path Operators · JSONata

1 Like

I was struggling with the $... Thanks!

$$. payload[$contains( $ ,"bara")]

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.