fix json encoding by encoding bytes as ascii
This commit is contained in:
parent
9320c68961
commit
078273f49f
1 changed files with 3 additions and 0 deletions
|
@ -101,6 +101,9 @@ def json_dumps(records):
|
||||||
if hasattr(o, 'toJSON') and isinstance(getattr(o, 'toJSON'), collections.Callable):
|
if hasattr(o, 'toJSON') and isinstance(getattr(o, 'toJSON'), collections.Callable):
|
||||||
return o.toJSON()
|
return o.toJSON()
|
||||||
|
|
||||||
|
if type(o) is bytes:
|
||||||
|
return o.decode('ascii')
|
||||||
|
|
||||||
elif isinstance(o, decimal.Decimal):
|
elif isinstance(o, decimal.Decimal):
|
||||||
return str(o.quantize(decimal.Decimal('0.01')))
|
return str(o.quantize(decimal.Decimal('0.01')))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue