Hope this question finds you all in good health.
As per title, would like to know how this is done in Groovy. Found a few, such as this, but the question and answer did not help.
The JSON is like this
def json = '''{
"boston": [
{
"name":"bob",
"phone":"242 123123",
},
{
"name":"alice",
"phone":"212-123-345",
}
],
"chicago": [
{
"name":"charlie",
"phone":"313-232-545",
},
{
"name":"denise",
"phone":"414-123-546",
}
]
}'''
But how do I use the value, for example bob to get boston
?
When you use parsedjson['chicago']['email']
, the result would be
[charlie@chicago.com, denise@chicago.com]
I tried to do something like
def getKey = parsedjson['email']?.key
as suggested here but in JIRA ScriptRunner console returned null
Any pointer is greatly appreciated in advance!