From 078273f49fb366be3fb1767e93ba637eacb54c05 Mon Sep 17 00:00:00 2001 From: Mark Riedesel Date: Sat, 7 Jan 2017 17:00:29 -0600 Subject: [PATCH] fix json encoding by encoding bytes as ascii --- pyaccuwage/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyaccuwage/__init__.py b/pyaccuwage/__init__.py index 2de4c7b..a6775be 100644 --- a/pyaccuwage/__init__.py +++ b/pyaccuwage/__init__.py @@ -101,6 +101,9 @@ def json_dumps(records): if hasattr(o, 'toJSON') and isinstance(getattr(o, 'toJSON'), collections.Callable): return o.toJSON() + if type(o) is bytes: + return o.decode('ascii') + elif isinstance(o, decimal.Decimal): return str(o.quantize(decimal.Decimal('0.01')))