I have been trying to extract only certain data from a JSON file using python.I wanted to create an array from my json which has some entries as below
[{"Device Name":"abc", "Device Caps":["a1", "b1", "c1"]},
{"Device Name":"def", "Device Caps":["a2", "b2", "c2"]},
{"Device Name":"ghi", "Device Caps":["a3", "b3", "c3"]},
{"Device Name":"jkl", "Device Caps":["a4", "b4", "c4"]}]
I need my output as ["a1","a2","a3","a4"]
[item["Device Caps"][0] for item in my_data]one=[item["Device Caps"][0] for item in data] TypeError: string indices must be integers, not str