diff --git a/rest_framework/utils/encoders.py b/rest_framework/utils/encoders.py index aa4542286..07508fb69 100644 --- a/rest_framework/utils/encoders.py +++ b/rest_framework/utils/encoders.py @@ -41,8 +41,7 @@ class JSONEncoder(json.JSONEncoder): elif isinstance(obj, datetime.timedelta): return str(obj.total_seconds()) elif isinstance(obj, decimal.Decimal): - # Serializers will coerce decimals to strings by default. - return float(obj) + return str(obj) elif isinstance(obj, uuid.UUID): return str(obj) elif isinstance(obj, QuerySet):