In python language. How can I get the inside data individually? For example, I want to get "Critical" for "table one for me" data.
Sorry for my bad English.
JSON File
{
"domain" : [{
"table one for me":
[
["Test1", "Critical"],
["Test2", "High"],
["Test3","Medium"]
]
},{
"table two for you":
[
["Test1", "Critical"],
["Test2", "High"],
["Test3","Medium"],
["Test4", "Low"]
]
}]
}
Dictionaries are like this: {'key':'value'}
and and you can access value using your_dict.get('key')
or your_dict['key']
.
Lists have this structure ['first element', 'second', 'third']
and you access the elements using integers eg your_list[0]
for the first element. So you can do:
j = {
"domain" : [{
"table one for me":
[
["Test1", "Critical"],
["Test2", "High"],
["Test3","Medium"]
]
},{
"table two for you":
[
["Test1", "Critical"],
["Test2", "High"],
["Test3","Medium"],
["Test4", "Low"]
]
}]
}
>>> j['domain'][0]['table one for me'][0]
['Test1', 'Critical']
>>> j.get('domain')[0].get('table one for me')[0]
['Test1', 'Critical']
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.