diff --git a/rest_framework/utils/encoders.py b/rest_framework/utils/encoders.py index 17cbd3cd5..b48b8ec0f 100644 --- a/rest_framework/utils/encoders.py +++ b/rest_framework/utils/encoders.py @@ -59,11 +59,11 @@ class JSONEncoder(json.JSONEncoder): # internals. if o != o: - text = 'null' + text = '"NaN"' elif o == _inf: - text = 'null' + text = '"Infinity"' elif o == _neginf: - text = 'null' + text = '"-Infinity"' else: return _repr(o)