Contributions
- 6 years agoPlace ReadyAPI QuestionsReadyAPI Questions1.8KViews0likes1Comment
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 = 36 years agoPlace ReadyAPI QuestionsReadyAPI Questions1.8KViews0likes3CommentsGroovy- 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: 26 years agoPlace ReadyAPI QuestionsReadyAPI Questions1.9KViews0likes5CommentsGroovy: 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}6 years agoPlace ReadyAPI QuestionsReadyAPI Questions4.1KViews0likes4CommentsRe: 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.6 years agoPlace ReadyAPI QuestionsReadyAPI Questions3KViews0likes2Comments- 6 years agoPlace ReadyAPI QuestionsReadyAPI Questions2KViews0likes1Comment
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!Solved6 years agoPlace ReadyAPI QuestionsReadyAPI Questions2.1KViews0likes5Comments