Read json file and get output values using python
<p>i want to fetch the output of below json file using python </p>

<p>Json file </p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>{
    "Name": [
        {
            "name": "John",
            "Avg": "55.7"
        },
        {
            "name": "Rose",
            "Avg": "71.23"
        },
        {
            "name": "Lola",
            "Avg": "78.93"
        },
        {
            "name": "Harry",
            "Avg": "95.5"
        }
     
    ]
}</code></pre>
</div>
</div>
</p>

<p>I want to get the average marks of the person, when i look for harry
i.e i need output in below or similar format
Harry = 95.5</p>

<p>Here's my code</p>

<pre><code>import json

json_file = open('test.json')  //the above contents are stored in the json
data = json.load(json_file)
do = data['Name'][0]
op1 = do['Name']
if op1 is 'Harry':
    print do['Avg']
</code></pre>

<p>But when i run i get error "IOError: [Errno 63] File name too long"</p>

<p>How to print the score of Harry with python 3</p>

<pre><code>import json
from pprint import pprint

with open('test.json') as data_file:
    data = json.load(data_file)

for l in data["Name"]:
    if (str(l['name']) == 'Harry'):
        pprint(l['Avg'])
</code></pre>

python json