mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #13182 -- Prevented trailing spaces in indented json output
Thanks Stéphane Raimbault for the report and the initial patch.
This commit is contained in:
@@ -31,6 +31,9 @@ class Serializer(PythonSerializer):
|
||||
self.json_kwargs = self.options.copy()
|
||||
self.json_kwargs.pop('stream', None)
|
||||
self.json_kwargs.pop('fields', None)
|
||||
if self.options.get('indent'):
|
||||
# Prevent trailing spaces
|
||||
self.json_kwargs['separators'] = (',', ': ')
|
||||
self.stream.write("[")
|
||||
|
||||
def end_serialization(self):
|
||||
|
||||
Reference in New Issue
Block a user