Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[py3] Fixed JSON deserialization

  • Loading branch information...
commit 7d0f8831922535502569a5dda989dde339b4e491 1 parent b82eb10
@claudep claudep authored
Showing with 3 additions and 4 deletions.
  1. +3 −4 django/core/serializers/json.py
View
7 django/core/serializers/json.py
@@ -61,13 +61,12 @@ def Deserializer(stream_or_string, **options):
"""
Deserialize a stream or string of JSON data.
"""
+ if not isinstance(stream_or_string, (bytes, six.string_types)):
+ stream_or_string = stream_or_string.read()
if isinstance(stream_or_string, bytes):
stream_or_string = stream_or_string.decode('utf-8')
try:
- if isinstance(stream_or_string, six.string_types):
- objects = json.loads(stream_or_string)
- else:
- objects = json.load(stream_or_string)
+ objects = json.loads(stream_or_string)
for obj in PythonDeserializer(objects, **options):
yield obj
except GeneratorExit:
Please sign in to comment.
Something went wrong with that request. Please try again.