json - 在json中添加换行符
问题描述
谁能让我知道如何在创建 json 时添加换行符。我正在尝试使用 api 在 zendesk 中使用评论更新票证。但是,问题是它需要格式化如下:
最后一封跟进电子邮件已发送给客户票 {{ticket.id}}。请致电客户并在票据上添加备注。
客户详细信息:
姓名:{{ticket.requester.name}}
电话:{{ticket.requester.phone}}谢谢
下面是我要发送的 Json。如果我添加一个简单的输入,那么我会收到错误。我相信对于使用过液体的人来说会很容易。
{
"ticket": {
"comment": {
"public": false,
"body": "The last follow up email has been sent to the customer for the ticket {{ticket.id}}. Please call the customer and add a note to the ticket. Customer details:Name: {{ticket.requester.name}}, Phone: {{ticket.requester.phone}} Thank you"
}
}
}
解决方案
\n
在需要换行的地方使用,例如
{
"ticket": {
"comment": {
"public": false,
"body": "The last follow up email has been sent to the customer for the ticket {{ticket.id}}. Please call the customer and add a note to the ticket.\nCustomer details:\nName: {{ticket.requester.name}},\nPhone: {{ticket.requester.phone}}\n\nThank you"
}
}
}
推荐阅读
- node.js - NodeJS fs.unlinkSync 没有释放 aws ec2 服务器上的硬盘空间
- java - 具有不同类型子类的 Java 对象,包括枚举
- c++ - 优雅快速的算子函数 cpp
- python - 这是函数的好习惯吗?
- c# - 使用 EF 生成的两个外键
- javascript - 如何使用代表下拉菜单的标签将函数链接到 div?
- mysql - SQL INNER JOIN 意外结果
- azure-devops - 在 Azure DevOps 中维护构建顺序的最佳实践?
- java - Gson 无法正确序列化带有等号的地图
- spacy - NER - 我应该在标记的实体中包含公共前缀吗