Json is below. I need to convert to list after loading from the json. I am getting as str
{
"1": {
"Data (L)": "[ { \"S\" : \"168\" }]"
},
"2": {
"Data (L)": "[ { \"S\" : \"169\" }]"
}
}
Code
with open('a.json') as f:
a = json.loads(f.read())
print (a)
data1 = []
for i,j in a.items():
data = {}
data['id'] = i
data1.append(data)
for k,l in j.items():
data[k] = l
print (type(l))
print (l)
My type pf l is <class 'str'>
where output of l
is [ { "S" : "168" }]
Expected out
print type(l) has to be list not str