title: convert json retrived from url
body: <p>I am partially able to work with json saved as file:</p>
  
  <pre><code>#! /usr/bin/python3
  
  import json
  from pprint import pprint
  
  json_file='a.json'
  json_data=open(json_file)
  data = json.load(json_data)
  json_data.close()
  print(data[10])
  </code></pre>
  
  <p>But I am trying to achieve the same from data directly  from web. I am trying with the accepted answer <a href="https://stackoverflow.com/questions/4634209/python-convert-json-returned-by-url-into-list">here</a>:</p>
  
  <pre><code>#! /usr/bin/python3
  
  from urllib.request import urlopen
  import json
  from pprint import pprint
  
  jsonget=urlopen("http://api.crossref.org/works?query.author=Rudra+Banerjee")
  
  data = json.load(jsonget)
  pprint(data)
  </code></pre>
  
  <p>which is giving me error:</p>
  
  <pre><code>  Traceback (most recent call last):
    File "i.py", line 10, in &lt;module&gt;
      data = json.load(jsonget)
    File "/usr/lib64/python3.5/json/__init__.py", line 268, in load
      parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
    File "/usr/lib64/python3.5/json/__init__.py", line 312, in loads
      s.__class__.__name__))
  TypeError: the JSON object must be str, not 'bytes'
  </code></pre>
  
  <p>What is going wrong here?</p>
  
  <p>Changing the code as par Charlie's reply to:</p>
  
  <pre><code>jsonget=str(urlopen("http://api.crossref.org/works?query.author=Rudra+Banerjee"))
  
  data = json.load(jsonget)
  pprint(jsonget)
  </code></pre>
  
  <p>breaks at <code>json.load</code>:</p>
  
  <pre><code>Traceback (most recent call last):
    File "i.py", line 9, in &lt;module&gt;
      data = json.load(jsonget)
    File "/usr/lib64/python3.5/json/__init__.py", line 265, in load
      return loads(fp.read(),
  AttributeError: 'str' object has no attribute 'read'
  </code></pre>