title: Dumping data to outputfile with python json.dump(Array, outfile)
body: <p>I am trying to write data I 'scraped' from a site to a json output file with the following code:</p>
  
  <pre><code>from bs4 import BeautifulSoup
  import requests
  import json
  
  path = ["https://www.test.be?page=,https://www.test2.be?page="]
  
  adresArr = []
  for i in path:
      pagina = 0;
      for x in range(0, 4):
          url = i + str(pagina)
          response = requests.get(url, timeout=5)
          content = BeautifulSoup(response.content, "html.parser")
          for adres in content.findAll('tr', attrs={"class": "odd clickable-row"}):
              adresObject = {
                  "postcode": adres.find('td', attrs={"class": "views-field views-field-field-locatie-postal-code"}).text.encode('utf-8'),
                  "naam": adres.find('td', attrs={"class": "views-field views-field-field-locatie-thoroughfare"}).text.encode('utf-8'),
                  "plaats": adres.find('td', attrs={"class": "views-field views-field-field-locatie-locality"}).text.encode('utf-8')
              }
              adresArr.append(adresObject)
  
  
          for adres in content.findAll('tr', attrs={"class": "odd clickable-row active"}):
              adresObject = {
                  "postcode": adres.find('td', attrs={"class": "views-field views-field-field-locatie-postal-code"}).text.encode('utf-8'),
                  "naam": adres.find('td', attrs={"class": "views-field views-field-field-locatie-thoroughfare"}).text.encode('utf-8'),
                  "plaats": adres.find('td', attrs={"class": "views-field views-field-field-locatie-locality"}).text.encode('utf-8')
              }
              adresArr.append(adresObject)
  
              pagina = x
  
      with open('adresData.json', 'w') as outfile:
           json.dump(adresArr, outfile)
  
  </code></pre>
  
  <p>I am getting the following <strong>error</strong>: <strong>object of type bytes is not json serializable</strong></p>
  
  <p>If I print the array itself, it looks OK. But i'm stuck at writing it to a json file.
  What am I doing wrong ?</p>
  
  <p>It's my first time coding in python (and not alot of coding experience) So please make your answer clear to understand :) </p>
  
  <p>Thanks in advance</p>