Retrieving size of JSON key using groovy script in EPBCS
Summary:
Need to retrieve size of keys in JSON array using EPBCS groovy script.
Content (required):
Hello guys,
I have the following JSON array:
def json_str = """{
"1010CC":
{
"user1": "abc@xyz.net",
"user2": "abc@xyz.net""
}
,
"1020CC":
{
"user1": "abc@xyz.net",
"user2": "abc@xyz.net",
"user3": "abc@xyz.net"
}
,
"2010CC":
{
"user1": "abc@xyz.net",
"user2": "abc@xyz.net"
} """
I need to get the size of the keys like for 1010CC-> size = 2, for 1020CC->size=3,etc.
I have tried the below.
Version (include the version you are using, if applicable):
Code Snippet (add any code snippets that support your topic, if applicable):