10 lines
214 B
Python
10 lines
214 B
Python
|
import json
|
||
|
from decimal import Decimal
|
||
|
|
||
|
|
||
|
class CustomJSONEncoder(json.JSONEncoder):
|
||
|
def default(self, obj):
|
||
|
if isinstance(obj, Decimal):
|
||
|
return str(obj)
|
||
|
return super().default(obj)
|