title: Object of type 'bytes' is not JSON serializable while calling an api
body: <p>I'm trying to save a form which involves an API call but its throwing me an error that </p>
  
  <blockquote>
    <p>Object of type 'bytes' is not JSON serializable.</p>
  </blockquote>
  
  <p>when I call data=json.dump(dump) it throws the following error</p>
  
  <pre><code> def getAttributes(self, jsonObj=False):
          attributes = vars(self)
          data = {var: value for var, value in attributes.items() if not var.startswith('_')}
          print(data, "data")
          if jsonObj:
              import json
              data = json.dumps(data)
  
          return data
  </code></pre>
  
  <p>p.s.: In print data statement it is returning me a dict. </p>