Extract part of data from JSON file using python
<p>I have been trying to extract only certain data from a JSON file using python.I wanted to create an array from my json which has some entries as below</p>

<pre><code>[{"Device Name":"abc", "Device Caps":["a1", "b1", "c1"]},
{"Device Name":"def", "Device Caps":["a2", "b2", "c2"]},
{"Device Name":"ghi", "Device Caps":["a3", "b3", "c3"]},
{"Device Name":"jkl", "Device Caps":["a4", "b4", "c4"]}] 
</code></pre>

<p>I need my output as 
    ["a1","a2","a3","a4"]</p>

<p>If that is literally your input file, then the following code will produce the output you want:</p>

<pre><code>import json

with open("input.json") as input_file:
    data = json.load(input_file)
data = [d["Device Caps"][0] for d in data]

print(data)
</code></pre>

python json extract decode