dimanche 4 janvier 2015

Convert Json into Dictionary in Python


Vote count:

0




Following Json is from Mongodb by querying collection.find() method. How do I convert this Json into Dictionary in Python? I want to map BMW as key and Series 3 as value in my dictionary.


Python:



content = list(collection.find({"_id": "sample_abc"}, {"Car":1, "_id":0}))
print (content)


Console:



[{'Car': [{'BMW': 'series 3'}, {'Audi': 'A4'}]}]


asked 26 secs ago







Convert Json into Dictionary in Python

Aucun commentaire:

Enregistrer un commentaire