I'm attempting to get multiple items from an array but it returns an error however if I get just one it does not. My code:
stockjson = json.loads(stockinfo.text)
test1 = stockjson['variation_list'][0]['test1']
print(test1)
Stockinfo:
{"id":"TestID","availability_status":"NOT_AVAILABLE","variation_list":[{"sku":"TEST1","availability":0,"availability_status":"NOT_AVAILABLE","test1":"test1"},[{"sku":"TEST2","availability":0,"availability_status":"NOT_AVAILABLE","test1":"test2"},
I would like to get the result of every test1 but if I take [0] out of my code I get:
test1 = stockjson['variation_list']['test1']
TypeError: list indices must be integers or slices, not str
I'd also like to find the SKU and the test1 for each section (not sure what to call it) thanks for any help provided