【发布时间】:2017-11-26 04:44:19
【问题描述】:
我必须在 Groovy 中创建这个 JSON 文件。
我尝试了很多事情 (JsonOutput.toJson() / JsonSlurper.parseText()) 都没有成功。
{
"attachments":[
{
"fallback":"New open task [Urgent]: <http://url_to_task|Test out Slack message attachments>",
"pretext":"New open task [Urgent]: <http://url_to_task|Test out Slack message attachments>",
"color":"#D00000",
"fields":[
{
"title":"Notes",
"value":"This is much easier than I thought it would be.",
"short":false
}
]
}
]
}
这是用于将 Jenkins 构建消息发布到 Slack。
【问题讨论】:
-
在您询问解析的问题标题中,以及您询问有关创建 json 文件的问题本身。你能澄清一下你想要/尝试做什么吗?
-
@daggett 我想将这些 JSON 对象创建为一个 groovy 变量。
标签: json jenkins groovy jenkins-pipeline