From 3f5c1425bcfd22fa20cc3cf82100b881b170b3e7 Mon Sep 17 00:00:00 2001 From: Andy Neff Date: Wed, 22 Feb 2017 10:13:44 -0500 Subject: [PATCH] Return strings instead of null --- rest_framework/utils/encoders.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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)