@chakravarthyakundi77 hi there
The thing is that you iterate through elements within usernames
level and not deeper. In your example, the element from usernames
has following settings for key
and value
:
key = user-east
value = {
"instance" = "sqlinst01
"name" = ["sql_user01","sql_user02"]
}
So when you refer to instance
via each.value.instance
you get a string, because it is a string indeed. But when you refer to name
via each.value.name
you get its real value — the set, which is also technically correct. But this is not what you expect, I know.
You might try to flatten this object with flatten() function