# Watcher with Json body

**URL:** <https://discuss.elastic.co/t/watcher-with-json-body/318847>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [November 14, 2022, 9:47am UTC](https://discuss.elastic.co/t/watcher-with-json-body/318847 "2022-11-14T09:47:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sudheendra](https://avatars.discourse-cdn.com/v4/letter/s/e0b2c6/32.png) [@sudheendra](https://discuss.elastic.co/u/sudheendra)\
**Post date:** [November 14, 2022, 9:47am UTC](https://discuss.elastic.co/t/watcher-with-json-body/318847/1 "2022-11-14T09:47:01Z")

</div>

I am using the watcher to send post request to webhook listener ,but I am failing to convert output array into json object .

"actions": { "send\_alert\_to\_jumpstart\_server": { "webhook": { "scheme": "http", "host": "\*\*\*\*\*", "port": 4455, "method": "post", "path": "/webhook", "params": {}, "headers": { "Authorization": "Bearer your\_token", "Content-Type": "application/json; charset=UTF-8" }, "body": """ [{{#ctx.payload.hits.hits}} { "timestamp" : "{{\_source.@timestamp}}","cluster\_name": "{{\_source.cluster\_id}}","gNBId" : "{{\_source.gNBId}}"}, {{/ctx.payload.hits.hits}}] """ } } },

BUT,  
**We are getting below error while executing watcher.**  
body": "\n **400 Bad Request** \n

# Bad Request
\n

**Failed to decode JSON object** : Expecting value: line 5 column 9 (char 345)

\n"

---

<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:** [December 12, 2022, 9:47am UTC](https://discuss.elastic.co/t/watcher-with-json-body/318847/2 "2022-12-12T09:47:06Z")

</div>

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