Create JSON strings from Groovy variables in Jenkins Pipeline
问题 I have to create this JSON file in Groovy. I have try many things ( JsonOutput.toJson() / JsonSlurper.parseText() ) unsuccessfully. { "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 } ] } ] } This is for posting a