Adding array to webhook body

alerting

(SatishKumar) #1

Hi i am facing one issue,

In the action before webbook i am doing a transform due to which i am getting the following array of users
"payload": {
"_value": [
"xyz",
"abc"
]
}
i want to pass this payload._value to the rest api with out any modification.
REST API expects user list "User": [ "user1", "user2"]

on using

"body" : "{
"User": "{{ctx.payload._value}}"
}"
it is going as "body": "{"User": "{0=xyz, 1=abc}" }"

can you help me in fixing this?


(Alexander Reelsen) #2

Hey,

check out the toJson directive of mustache scripting. See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-template.html#_converting_parameters_to_json

--Alex


(SatishKumar) #3

thanks Alex


(system) #4

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.