title: Why is it giving me the error, "the JSON object must be str, not 'bytes'", and how do I fix it?
body: <p>I was following a tutorial about how to use JSON objects (link: <a href="https://www.youtube.com/watch?v=Y5dU2aGHTZg" rel="nofollow">https://www.youtube.com/watch?v=Y5dU2aGHTZg</a>). When they ran the code, they got no errors, but I did. Is it something to do with different Python versions or something?</p>
  
  <pre><code>from urllib.request import urlopen
  import json
  
  def printResults(data):
      theJSON = json.loads(data)
      print (theJSON)
  
  def main():
      urlData ="http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/2.5_day.geojson"
  
      webUrl = urlopen(urlData)
      print(webUrl.getcode())
      if (webUrl.getcode()==200):
          data = webUrl.read()
          printResults(data)
      else:
          print ("You failed")
  
  main()
  </code></pre>