title: bytearray is not JSON serializable
body: <p>I get this error message in <code>Python/Django</code>: <code>bytearray(b'') is not JSON serializable</code>. Currently, I do it like this:</p>
  
  <pre><code>...
  from django.core.serializers.json import DjangoJSONEncoder
  ...
  
  output = json.dumps(data, cls=DjangoJSONEncoder)
  return HttpResponse(output)
  </code></pre>
  
  <p>I import <code>DjangoJSONEncoder</code>, because before that I had problem with <code>datetime</code>. That problem went away, but now I have another problem with type <code>bytearray</code>. So, I'm interested to know, if there is a standard and universal way of creating json string, no matter what data types you use.</p>