1

My Code is

configfile = open("abc.txt",'rb').read()
return base64.b64encode(configfile)

got error "Object of type 'bytes' is not JSON serializable in python3.6" on ec2

Khan Muhammad
  • 412
  • 5
  • 18

1 Answers1

1

Above issue appeared when i updated Django 1.8 to Django 2.2.6

I solve this by

Consider installing and using [simplejson][1], which can handle bytes strings in addition to unicode, to install it use command below:

pip3 install simplejson

Usage in code:

import simplejson as json

json.dumps({b'name': b'dev'})

This will solve JSON serializable issue.

Khan Muhammad
  • 412
  • 5
  • 18