From 9c29215befdb2f88ced14d53d62ffc603f13a876 Mon Sep 17 00:00:00 2001 From: Patrick Connolly Date: Sun, 24 Apr 2016 14:55:08 -0400 Subject: [PATCH] Place brackets on own lines with JsonItemExporter. Placing the opening and closing brackets on their own lines makes it slightly easier to sort lines after the `spider_closed` signal is fired. --- scrapy/exporters.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scrapy/exporters.py b/scrapy/exporters.py index 360007c0f..d507bcf31 100644 --- a/scrapy/exporters.py +++ b/scrapy/exporters.py @@ -100,10 +100,10 @@ class JsonItemExporter(BaseItemExporter): self.first_item = True def start_exporting(self): - self.file.write(b"[") + self.file.write(b"[\n") def finish_exporting(self): - self.file.write(b"]") + self.file.write(b"\n]") def export_item(self, item): if self.first_item: