import json a = """{ "ok": true, "_shards": { "total": 2, "successful": 1, "failed": 0 }, "indices": { "client_ind_2": { "index": { "primary_size": "2.5mb", "primary_size_in_bytes": 2710326, "size": "2.5mb", "size_in_bytes": 2710326 } } } }""" b = json.loads(a) print(b['ok']) print(b['indices']['client_ind_2']['index'])
This will take json as a python dictionary and print “ok” and the index value you want:
True {u'primary_size': u'2.5mb', u'primary_size_in_bytes': 2710326, u'size_in_bytes': 2710326, u'size': u'2.5mb'}
iblazevic
source share