kiko
6 years agoNew Contributor
How can we combine two fields without explicitly referencing them?
Hello,
we are trying to combine pairs of fields, without knowing their names in advanced.
INPUT
{ "field1": "val1", "field2": "val2" }
OUTPUT
{ "field12": "val1_val2" }
The output could be something different. Our goal is to check the value of both fields and depending on them generate a specific output. Is there any way to do something like that without having to refer to the field name?
Thanks
Hi Kiko,
I did use the _ from the key name to filter it out…
here’s the expression:
$input.mapValues((v,k)=> !(k).contains('_') ? $input.filter((i,j)=> j.startsWith(k)).values().join('_') : null).filter((v,k)=> !(v instanceof Null))