1 回答

TA貢獻(xiàn)1827條經(jīng)驗(yàn) 獲得超8個(gè)贊
在groovy中有內(nèi)置和代碼來查找其中一個(gè)值,可能是這樣的:groovy.json.JsonSlurper
def json = new groovy.json.JsonSlurper().parseText('''
{
"deployment_name": "name1",
"model": {
"model": {
"description": "",
"nodes": [{
"id": "OS Node",
"ptype": "image:OS Node",
"attributes": {
"ConfigPWD_USER.password": "1<xor>NzozMzA=",
"ConfigPWD_ROOT.password": "1<xor>NzozMzA="
},
"type": "image:OS",
"groups": {},
"locked": []
}, {
"id": "disk for db instance",
"attributes": {
"ConfigPWD_USER.password": "2<xor>NzozMzA=",
"ConfigPWD_ROOT.password": "2<xor>NzozMzA="
},
"type": "add disk:1.0.0",
"groups": {},
"locked": []
}]
}
}
}
''')
json.model.model.nodes.collect{n-> n.attributes."ConfigPWD_USER.password" }
添加回答
舉報(bào)