Custom format of displayed array objects

(Krzysztof) #1

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 ?

(Alexander Reelsen) #2

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

(Krzysztof) #3

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 ?

(Alexander Reelsen) #4

Sorry, forgot to add a link. I was referring to a script transform and you can learn more about it here:

(system) closed #5

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