diff --git a/django/core/serializers/json.py b/django/core/serializers/json.py
index b8119f5..1770afc 100644
--- a/django/core/serializers/json.py
+++ b/django/core/serializers/json.py
@@ -18,6 +18,11 @@ class Serializer(PythonSerializer):
     internal_use_only = False
 
     def end_serialization(self):
+        if self.options.get('indent'):
+            # The default is (', ', ': '). To eliminate useless whitespaces
+            # after the comma at the end of each line, the representation is
+            # changed to (',', ': ') only if indent is used.
+            self.options['separators'] = (',', ': ')
         simplejson.dump(self.objects, self.stream, cls=DjangoJSONEncoder, **self.options)
 
     def getvalue(self):
diff --git a/tests/modeltests/serializers/tests.py b/tests/modeltests/serializers/tests.py
index 013438e..d03b08b 100644
--- a/tests/modeltests/serializers/tests.py
+++ b/tests/modeltests/serializers/tests.py
@@ -360,6 +360,33 @@ class JsonSerializerTestCase(SerializersTestBase, TestCase):
                 ret_list.append(obj_dict["fields"][field_name])
         return ret_list
 
+    def test_indentation_whitespace(self):
+        """ Ensure that there are no extraneous spaces after the comma at the
+            end of each line.
+            Refs #13182.
+        """
+        from django.core.serializers.json import Serializer
+        Score.objects.create(score=5.0)
+        Score.objects.create(score=6.0)
+        qset = Score.objects.all()
+        s = Serializer()
+        self.assertEqual(s.serialize(qset,indent=2), """[
+  {
+    "pk": 1,
+    "model": "serializers.score",
+    "fields": {
+      "score": 5.0
+    }
+  },
+  {
+    "pk": 2,
+    "model": "serializers.score",
+    "fields": {
+      "score": 6.0
+    }
+  }
+]""")
+    
 class JsonSerializerTransactionTestCase(SerializersTransactionTestBase, TransactionTestCase):
     serializer_name = "json"
     fwd_ref_str = """[
