my response content is
{"VoucherQuantityResult":[{"ErrorCode":"E057","ErrorMessage":"IP not registered","Message":"IP not registered","QuantityResponse":[],"ResultType":"FAILED"}]}
responseDetails = response.json() results
{u'VoucherQuantityResult': [{u'ErrorCode': u'E057', u'ResultType': u'FAILED', u'Message': u'IP not registered', u'ErrorMessage': u'IP not registered', u'QuantityResponse': []}]}
then if I call, errorCode = responseDetails['ErrorCode']['ResultType']
there is error KeyError: 'ErrorCode'
I have even used the dumps function, json.dumps(response.json())
then the error is,
TypeError: string indices must be integers, not str
Can some one suggest me how to fetch the keys and values without unicode?
Note: if I use python3 then I dont see any unicode character. still the issue
errorCode = responseDetails['ErrorCode']['value']
KeyError: 'ErrorCode'
Thanks