I have a JSON file that looks like this:
I have a list of device ID's, and I'd like to search my JSON for a specific value of the id, to get the name.
The data that is now is JSON format used to be in XML format, for which I used to do this:
device = xml.find("devices/device[@id=\'%s\']" %someDeviceID)
deviceName = device.attrib['name']
--
So far based on answers online I have managed to search the JSON for a jey, but I haven't yet managed to search for a value.

data['devices'][someDeviceId]. Parse it withdata = json.loads(...)before if you need. You owe me a beer. ;)import jsonand usejson.loads(open(filename, 'r').read())to read this file into a python object, then do what @freakish posted above. And you owe him a beer. ETA: Usedata['devices'].get('someDeviceId')if you're not sure if 'someDeviceId` exists.devicesis an array. Fair enough. Then you have to search it, my friend. Either convert it to a dict (assuming ids are unique) or search linearly:next(dev for dev in data['devices'] if dev['id'] == someId).