【发布时间】:2019-10-16 12:01:19
【问题描述】:
我无法使用 readJSON 从 JSON 读取所有“type-X.X”键
oldJson 字符串:
{
"branch":{
"type-0.2":{"version":"0.2","rc":"1","rel":"1","extras":"1"}}
"type-0.3":{"version":"0.3","rc":"1","rel":"1","extras":"1"}}
}
我尝试像示例一样访问它 https://jenkins.io/doc/pipeline/steps/pipeline-utility-steps/#readjson-read-json-from-files-in-the-workspace
def branchList = new JsonSlurper().parseText(oldJson['branch'])
echo (branchList.keySet().toString())
但它失败了:
hudson.remoting.ProxyException: groovy.lang.MissingMethodException: 否 方法签名:groovy.json.JsonSlurper.parseText() 适用 对于参数类型:(net.sf.json.JSONObject) 值:
我想要一个列表 ["type-0.2", "type-0.3"]
【问题讨论】:
标签: jenkins groovy jenkins-pipeline jenkins-plugins jenkins-groovy