# Custom format of displayed array objects

**URL:** <https://discuss.elastic.co/t/custom-format-of-displayed-array-objects/140915>\
**Category:** Elasticsearch\
**Created:** [July 20, 2018, 2:31pm UTC](https://discuss.elastic.co/t/custom-format-of-displayed-array-objects/140915 "2018-07-20T14:31:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kskubala](https://avatars.discourse-cdn.com/v4/letter/k/c5a1d2/32.png) [@kskubala](https://discuss.elastic.co/u/kskubala)\
**Post date:** [July 20, 2018, 2:31pm UTC](https://discuss.elastic.co/t/custom-format-of-displayed-array-objects/140915/1 "2018-07-20T14:31:53Z")

</div>

Hi,  
I have a watcher that as an action for met condition sends an email. In the e-mail body I send arrayList object with all those aggregated data that met the condition. Transformation is written in painless.

> "actions": {  
> "send\_email": {  
> "email": {  
> "to": "\*\*\*\*\*\*\*\*",  
> "subject": "\*\*\*\*\*\*\*\*\*\*",  
> "body": "Found too many UI errors in the logs for:\n {{ctx.payload.logs}}"  
> }  
> },

Since {{ctx.payload.logs}} returns data in the way that is not friendly to read I would like to do something like toString override. For example I would like to escape curly brackets and each item start from a new line. Any ideas ?

---

<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:** [July 23, 2018, 7:06am UTC](https://discuss.elastic.co/t/custom-format-of-displayed-array-objects/140915/2 "2018-07-23T07:06:09Z")

</div>

you can use a transform to modify the data. you can also iterate through lists using mustache - very likely you need to do both.

---

<div class="post-metadata">

**Author:** ![kskubala](https://avatars.discourse-cdn.com/v4/letter/k/c5a1d2/32.png) [@kskubala](https://discuss.elastic.co/u/kskubala)\
**Post date:** [July 23, 2018, 7:31am UTC](https://discuss.elastic.co/t/custom-format-of-displayed-array-objects/140915/3 "2018-07-23T07:31:27Z")

</div>

I do use mustache to iterate through, but I don't know how to change the way data is displayed. Can you give me example of a transformation ?

---

<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:** [July 23, 2018, 11:46am UTC](https://discuss.elastic.co/t/custom-format-of-displayed-array-objects/140915/4 "2018-07-23T11:46:21Z")

</div>

Sorry, forgot to add a link. I was referring to a `script transform` and you can learn more about it here: [https://www.elastic.co/guide/en/elastic-stack-overview/6.3/transform-script.html#transform-script](https://www.elastic.co/guide/en/elastic-stack-overview/6.3/transform-script.html#transform-script)

---

<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:** [August 20, 2018, 11:46am UTC](https://discuss.elastic.co/t/custom-format-of-displayed-array-objects/140915/5 "2018-08-20T11:46:23Z")

</div>

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