# Adding array to webhook body

**URL:** <https://discuss.elastic.co/t/adding-array-to-webhook-body/74239>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [February 7, 2017, 3:20pm UTC](https://discuss.elastic.co/t/adding-array-to-webhook-body/74239 "2017-02-07T15:20:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![satishsnv](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@satishsnv](https://discuss.elastic.co/u/satishsnv)\
**Post date:** [February 7, 2017, 3:20pm UTC](https://discuss.elastic.co/t/adding-array-to-webhook-body/74239/1 "2017-02-07T15:20:35Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [February 8, 2017, 9:23pm UTC](https://discuss.elastic.co/t/adding-array-to-webhook-body/74239/2 "2017-02-08T21:23:48Z")

</div>

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](https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-template.html#_converting_parameters_to_json)

--Alex

---

<div class="post-metadata">

**Author:** ![satishsnv](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@satishsnv](https://discuss.elastic.co/u/satishsnv)\
**Post date:** [February 15, 2017, 11:50am UTC](https://discuss.elastic.co/t/adding-array-to-webhook-body/74239/3 "2017-02-15T11:50:45Z")

</div>

thanks Alex

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 15, 2017, 11:51am UTC](https://discuss.elastic.co/t/adding-array-to-webhook-body/74239/4 "2017-03-15T11:51:14Z")

</div>

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