Reading a json file python -
i have json file need extract values from. i've had through docs , few other examples still have no idea how (i'm new dealing jsons). here bit json file
{ "response": { "success": 1, "current_time": 1436797884, "items": { "a color similar slate": { "last_updated": 1436796007, "quantity": 51, "value": 101 }, "a deep commitment purple": { "last_updated": 1436796007, "quantity": 212, "value": 101 }, "a distinctive lack of hue": { "last_updated": 1436796007, "quantity": 141, "value": 500 } } } } i need each key out eg "a color similar slate" , need items quantity , value out aswell each key.
obviously didn't read documentation...
>>> data = json.load( ... open('file.json') ... ) >>> data['response']['items'].keys() [u'a color similar slate', u'a deep commitment purple', u'a distinctive lack of hue']
Comments
Post a Comment