Converting dictionary to JSON

653    Asked by AkanshaChawla in SQL Server , Asked on Nov 30, -0001

 r = {'is_claimed': 'True', 'rating': 3.5}

r = json.dumps(r)

file.write(str(r['rating']))

I am not able to access my data in the JSON. What am I doing wrong?

TypeError: string indices must be integers, not str


Your Answer

Interviews

Parent Categories