【发布时间】:2018-11-16 14:48:33
【问题描述】:
考虑代码:
Map prJsonData = readJSON text: '{}'
prJsonData.head = "release/${NEW_TAG}" as String
prJsonData.title = "Release ${NEW_TAG}"
writeJSON(file: 'create-pr.json', json: prJsonData, pretty: 4)
和输出
{
"head": "release/v1.0.2",
"title": {
"bytes": [
82,
101,
97
],
"strings": [
"Release ",
""
],
"valueCount": 1,
"values": ["v1.0.2"]
}
}
为什么指定 as String 会更改输出,以便插值有效,但如果没有这个,输出似乎是某种复杂类型。
【问题讨论】:
标签: groovy