I am creating a JSON (Transfer a ticket content to another ticket) for a HTTP Target:
{
"ticket": {
"subject":"{{ticket.title}}",
"description":"{{ticket.description}}",
"type":"{{ticket.ticket_type}}",
"priority": "{{ticket.priority}}",
"tags":"{{ticket.tags}}",
"status": "{{ticket.status}}",
"comment":"{{ticket.comments_formatted}}",
"requester": { "name": "{{ticket.requester.name}}", "email": "{{ticket.requester.email}}" },
"collaborators": ["{% capture emails %}{% for cc in ticket.ccs %}{% unless forloop.last %}{{ cc.email | append: '\", \"' }}{% else %}{{ cc.email }}{% endunless %}{% endfor %}{% endcapture %}{{ emails | strip_newlines | replace: '\\', ''}}"]
}
However, the collaborators does not work. The correct format should be
My code's output is:
I am wondering that how to skip the \ sign?
Thanks!
I have solved this issue, I want to post my solution here:
"{% capture emails %}{% for cc in ticket.ccs %}{% unless forloop.last %}{{ cc.email | append: '", "' }}{% else %}{{ cc.email }}{% endunless %}{% endfor %}{% endcapture %}{{ emails | strip_newlines }}"
"collaborators":"{{dc_ccs}}"
This can transfer all CCs from the old ticket to the new ticket.