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

  • If the data you’re receiving in the response isn’t JSON, then you don’t want to have “DEFAULT” selected as the response type on the REST snap. You probably want to select “BINARY” (if XLSX) and then treat your data as such in the downstream snaps.

3 Replies

  • darshthakkar's avatar
    darshthakkar
    Valued Contributor

    @karthik_dhina: The solution has been provided by @bojanvelevski - trust me it works. If at all you do not want to use a mapper then you can always leverage some snaps like filter and router for the same but you’ll have to use a mapper after the results are filtered and assign the default value.

    Alternatively, you can also use Conditional snap to achieve similar use cases.