ContributionsMost RecentMost LikesSolutionsRe: Groovy- count all nulls in an array Thank you! Aaron. Re: Groovy- count all nulls in an array Hi Aaron,This is something different from previous with inner loops. Json : {"prods": [{"Item":13,"rate":200, "Ids": []}, {"Item":14,"rate":300, "Ids": []}, {"Item":15,"rate":100, "Ids": [ {"level": 1}]}, {"Item":16,"rate":700, "Ids": [ {"level": 1}]}, {"Item":17,"rate":500, "Ids": [ {"level": 2} ], [{"level": 2}, {"level": 2}]} ]}. So, Iretrieve the Ids as below: def jsonids = json.Ids log.info jsonids [[], [], [1], [1], [2, 2, 2]] But I dont how to read/count the above and get the results like below: Ids [] =: 2, Level 1 = 2, Level 2 = 3 Groovy- count all nulls in an array I want to print how many nulls, 1's and 2's seperately. Json : {"prods": [{"Item":13,"rate":200, "Ids": []}, {"Item":13,"rate":200, "Ids": []}, {"Item":11,"rate": 100, "Ids": [ {"level": 1}]}, {"Item":13,"rate":200, "Ids": [ {"level": 1}]}, {"Item":12,"rate":200, "Ids": [ {"level": 2} ], [{"level": 2}, {"level": 2}]} ]}. I tried and couldnt get the counts seperately.def jsonids = json.Ids log.info jsonids [[], [], [1], [1], [2, 2, 2]] I want the results like below: Level []: 2, Level 1: 2, Level 2: 3 Any help is appreciated. Nulls: 2 Re: Groovy: compare the date format Lucian, I wanted to read the date(milliseconds)from each array of Json1(convert this date to yyyy-mm-dd) and compare it with Json2 date (yyyy-mm-dd)of each array. Groovy: compare the date format I want to compare the date from json 1 & json 2 and display if its match or not in this array. Json1 : {"prods": [{"Item":"11","date": "2018-08-08"} Json2: {"prods": [{"Item":"12","date": 1533700800000} Re: Groupby using groovy For that request,I wanted to get results like : Level nulls : 2 Level one's : 2 Level two's : 3 Re: Groupby using groovy I want to print how many nulls, 1's and 2's seperately. Json : {"prods": [{"Item":13,"rate":200, "Ids": []}, {"Item":13,"rate":200, "Ids": []}, {"Item":11,"rate": 100, "Ids": [ {"level": 1}]}, {"Item":13,"rate":200, "Ids": [ {"level": 1}]}, {"Item":12,"rate":200, "Ids": [ {"level": 2} ], [{"level": 2}, {"level": 2}]} ]}. def jsonids = json.Ids log.info jsonids [[], [], [1], [1], [2, 2, 2]] I tried and couldnt seperate...Any help is appreciated. Re: Json response for inner loop It works. Thank youaaronpliu for your help! Re: Json response for inner loop Thank youaaronpliu. I get the result as 1,2,2,1. I wanted to groupBy this as Level [ 1: 2], Level [2:2] for this result. Json response for inner loop Json : {"prods": [{"Item":11,"rate": 100, "Ids": [ {"level": 1}]}, {"Item":12,"rate":200, "Ids": [ {"level": 2}, {"level": 2}, {"level": 2}]}, {"Item":13,"rate":200}, "Ids": [ {"level": 1}]]}. I'm trying to groupby an attribute LEVEL and get a sum of it.... I could get it correctly only for which the level has 1. But I couldnt get the result as expected for level 2 as its has an inner loop... I'm looking for a result as: Level: 1, Count per level : [1: 50] Level: 2, Count per level : [2.25] Appreciate your help! Solved