3

I have a event with an Arraylist :

I have an Arraylist :

"TelephoneDetails": {
    "Telephone": [
     {
       "Number": "<Number>",
        "Type": "<Type>",
        "Primary": "<Primary>",
       "TextEnabled": "<TextEnabled>"
     },{
        "Number": "<Number>",
        "Type": "<Type>",
        "Primary": "<Primary>",
        "TextEnabled": "<TextEnabled>"
     }
    ]
}
how to write the InputTransformer for the InputPath for this ? ,

i can get the Telephone[0]using this

{

  "Type": "$.detail.payload.TelephoneDetails.Telephone[0].Type",
  "Number": "$.detail.payload.TelephoneDetails.Telephone[0].Number",
  "Primary": "$.detail.payload.TelephoneDetails.Telephone[0].Primary",
  "TextEnabled": "$.detail.payload.TelephoneDetails.Telephone[0].TextEnabled"

}

not understanding how to write, if I have ArrayList of N?

Anitha
  • 165
  • 2
  • 9

2 Answers2

0

Is simple as that:

"TextEnabled": "$.detail.payload.TelephoneDetails.Telephone[*].TextEnabled"

please note the [*] instead of [0] to let the template engine iterates over the list of Telephones

  • 2
    No, that doesn't work. Using `[*]` instead of `[0]` results in the following error: `Output can not be generated, because field "$.detail.payload.TelephoneDetails.Telephone[*].TextEnabled" can not be found in the sample event` – Rob Sep 02 '22 at 17:32
-1

I think you can't do this with plain EB syntax. Probably the best way would be to put a lambda function as target of your EB rule, make the transformations and then forward it to your target.

Marcin
  • 215,873
  • 14
  • 235
  • 294