Skip to content
Advertisement

How do I iterate over a json object that has a list of dictionaries inside in Python?

How can I iterate over this to get get MerchantRequestID, CheckoutRequestID, ResultCode, ResultDesc, and all the value in the ‘item’ list for instance value for PhoneNumber. Am getting this data from a callBackURl after a user makes a payment.

JavaScript

Advertisement

Answer

If the data is just a dictionary starting at "Body" and not a list containing a dictionary, then just remove the first [0] from each variable, then check your spelling on Value as so:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement