diff --git a/CHANGELOG.md b/CHANGELOG.md index 58260f6..e0064b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 2.0.2 (2022-03-23) + * Using orjson instead of simplejson or other serializers for speed benefit + * Fix: Output decimal.Decimal as int or float not str + ## 2.0.1 (2021-11-23) * Fixed an issue when `format_message` returned newline character diff --git a/singer/messages.py b/singer/messages.py index 63e89c0..e7b9642 100644 --- a/singer/messages.py +++ b/singer/messages.py @@ -295,7 +295,7 @@ def parse_message(msg): def format_message(message, option=0): def default(obj): if isinstance(obj, decimal.Decimal): - return str(obj) + return int(obj) if float(obj).is_integer() else float(obj) raise TypeError return orjson.dumps(message.asdict(), option=option, default=default)