Java Groovy-在映射中获取子键
我有以下Java Groovy-在映射中获取子键,java,dictionary,groovy,hashmap,Java,Dictionary,Groovy,Hashmap,我有以下地图: errors:[[context:null, message:A restriction with the matcher ID refs/heads/devel already exists, exceptionName:com.atlassian.stash.internal.hooks.permissions.DuplicateRestrictedRefException]] 假设对象名为mappedJson如何检查errors中是否存在exceptionName键 我尝
地图
:
errors:[[context:null, message:A restriction with the matcher ID refs/heads/devel already exists, exceptionName:com.atlassian.stash.internal.hooks.permissions.DuplicateRestrictedRefException]]
假设对象名为mappedJson
如何检查errors
中是否存在exceptionName
键
我尝试了
mappedJson.errors*.exceptionName
?它将返回给我一个列表,即使exceptionName
不存在,该列表将如下所示:[null]
,但它对我没有帮助。有布尔函数吗?boolean exists=mappedJson.errors*.exceptionName.any()
?谢谢,我会试试的