79511084

Date: 2025-03-15 12:03:10
Score: 0.5
Natty:
Report link

I would like to thank each one of you, who spared time for going through the problem statement. As a part of good gesture, i am posting the final code-snippet that worked for me, after suggestions by @ekhumoro, @OldBoy , @KlausD, @deceze

 for key, each_items_in_json in respJson.items():  ---suggested changes by @ekhumoro
             if key=='cart': ---suggested changes by @ekhumoro
                    for items_in in each_items_in_json:
                     if items_in['benefit_id']!='-1':
                         if items_in['plan_id']!='-1':
                             if items_in['change']== 0:
                                 if items_in['id'] is not None:
                                    storeListsItemsFromJSON["user_id"]=items_in['id']
         storeListsItemsFromJSON["mid-term"]= False      
         JSONtoUseInNextAPI=json.dumps(storeListsItemsFromJSON)       
Reasons:
  • Whitelisted phrase (-1): worked for me
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @ekhumoro
  • User mentioned (0): @OldBoy
  • User mentioned (0): @KlausD
  • User mentioned (0): @deceze
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Abhijeet Goswami