Liquid `json` filter used in ticket triggers/webhooks has unexpected results.



2025년 4월 08일에 게시됨

Liquid has a filter called `json` that converts an object into a JSON string. This would be extremely convenient for webhooks, as it would allow admins to easily construct JSON strings with these objects and send them to their applications.

 

However, Zendesk's implementation of the Liquid `json` filter seems to be having unexpected results when compared to the Shopify Documentation and Liquid JS Implementation.

 

What should happen is that for an array, the array should be converted to an array of strings and then stringified, creating a valid JSON string. Here is an example:

 

{
  "origin": "My Webhook",
  "ccs": {{ ticket.ccs | map: "email" | json }}
}

Which should result in this valid JSON string:

{
  "origin": "My Webhook",
  "ccs": ["first@test.com","second@test.com"]
}

However, Zendesk's liquid implementation escapes the quotation marks, resulting in invalid JSON:

{
  "origin": "My Webhook",
  "ccs": [\"first@test.com\",\"second@test.com\"]
}

The Shopify documentation does mention that the json filter will escape any quotes in the output, but as can be seen in their example, this does not mean that the quotations around the strings themselves should be escaped. Unless I am understanding the structure of the ticket.ccs object wrong, this is a mistake in Zendesk's implementation.


1

1

댓글 1개

Hey Skyler,
 
Thank you for taking the time to provide us with your feedback. This has been logged for our PM team to review. For others who may be interested in this feature request, please add your support by upvoting this post and/or adding your use case to the comments below. Thank you again!

0


댓글을 남기려면 로그인하세요.

원하는 정보를 못 찾으셨나요?

새 게시물