diff --git a/django/core/serializers/json.py b/django/core/serializers/json.py
index 64357bf..b0b88d5 100644
a
|
b
|
class Serializer(PythonSerializer):
|
36 | 36 | if self.options.get("indent"): |
37 | 37 | self.stream.write("\n") |
38 | 38 | self.stream.write("]") |
39 | | if self.options.get("indent"): |
40 | | self.stream.write("\n") |
41 | 39 | |
42 | 40 | def end_object(self, obj): |
43 | 41 | # self._current has the field data |
diff --git a/tests/serializers/tests.py b/tests/serializers/tests.py
index a96a1af..1bec907 100644
a
|
b
|
class JsonSerializerTestCase(SerializersTestBase, TestCase):
|
389 | 389 | ret_list.append(obj_dict["fields"][field_name]) |
390 | 390 | return ret_list |
391 | 391 | |
| 392 | _json_expected="""[ |
| 393 | { |
| 394 | "pk": 1, |
| 395 | "model": "serializers.score", |
| 396 | "fields": { |
| 397 | "score": 5.0 |
| 398 | } |
| 399 | }, |
| 400 | { |
| 401 | "pk": 2, |
| 402 | "model": "serializers.score", |
| 403 | "fields": { |
| 404 | "score": 6.0 |
| 405 | } |
| 406 | } |
| 407 | ]""" |
| 408 | |
| 409 | |
| 410 | class TestJsonSerializerIndentation(TestCase): |
| 411 | def test_indentation_whitespace(self): |
| 412 | from django.core.serializers.json import Serializer |
| 413 | Score.objects.create(score=5.0) |
| 414 | Score.objects.create(score=6.0) |
| 415 | qset = Score.objects.all() |
| 416 | |
| 417 | s = Serializer() |
| 418 | self.assertEqual(s.serialize(qset, indent=2), _json_expected) |
| 419 | |
392 | 420 | class JsonSerializerTransactionTestCase(SerializersTransactionTestBase, TransactionTestCase): |
393 | 421 | serializer_name = "json" |
394 | 422 | fwd_ref_str = """[ |