How to encode Python Decimal to Json Number
How to convert Decimal("123456789012345.99") to json number 123456789012345.99? Python 3.11 win64 import json from decimal import Decimal class DecimalToFloat(json.JSONEncoder): def default(self, obj): if isinstance(obj, Decimal): return float(obj) return json.JSONEncoder.default(self, obj) class DecimalToStr(json.JSONEncoder): def default(self, obj): if isinstance(obj, Decimal): return str(obj)…