Forum Discussion

kiko's avatar
kiko
New Contributor
6 years ago
Solved

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 outp...
  • alchemiz's avatar
    alchemiz
    6 years ago

    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))