I don’t know jmespath actually. My suggestion is to solve it with plain javascript.
So this {{ $json.tags.filter(tag => tag.startsWith(‘cat_’)).first() }} would be the substitution for {{ $jmespath($json.tags, "[?contains(@, ‘cat_’)][] ") }}. With the .first() you’ll get the first element with starts with cat_. This will solve your problem so far.
Firstly, sorry for the delay in responding.
Regarding your answer, thank you, that’s exactly what I needed, however, I have a problem. When there is no result it is returned as “undefined”, is it possible to handle this? that is, if it doesn’t find any results, does it return a default value?