假设您的json在String中
jsonTxt,则可以执行以下操作:
def json = new groovy.json.JsonSlurper().parseText( jsonTxt )def recursiveChildrenScan( map, key, value ) { if( !map ) { null } else if( map[ key ] == value ) { map.children } else { map.children.findResult { recursiveChildrenScan( it, key, value ) } }}println json.findResult { recursiveChildrenScan( it, 'label', 'snap2' ) }?.label


