How to access map values in groovy by key containing dot?
I have map like this:
data = 开发者_高级运维{user.name: "John",
user.surname: "Doe",
city: "NY"}
I can access attiribute 'city' this way:
data.city
Is there is a similar way to access 'user.name' attribute?
Assuming you meant:
data = [ 'user.name':"John", 'user.surname':"Doe", city:"NY" ]
(square braces for the map definition, and quotes round the dotted key names), I believe that
data.'user.name'
should do it
精彩评论