TypeError: the JSON object must be str, bytes or bytearray, not 'dict'

This seems to be a general bug in frappe – it’s not possible to create new documents via the API at the moment.

https://github.com/frappe/frappe/issues/8230

Unfortunately you’ll have to wait until the fix gets merged.