From 19867659f3eb8a3e018e9b38fd9520f9fa4392cd Mon Sep 17 00:00:00 2001 From: Jalil SA <61639983+jxlil@users.noreply.github.com> Date: Thu, 17 Aug 2023 10:22:17 -0600 Subject: [PATCH] fix: response.json() call makes unnecessary memory allocation --- scrapy/http/response/text.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scrapy/http/response/text.py b/scrapy/http/response/text.py index 7fc54b5d3..47d7bc10f 100644 --- a/scrapy/http/response/text.py +++ b/scrapy/http/response/text.py @@ -82,7 +82,7 @@ class TextResponse(Response): Deserialize a JSON document to a Python object. """ if self._cached_decoded_json is _NONE: - self._cached_decoded_json = json.loads(self.text) + self._cached_decoded_json = json.loads(self.body) return self._cached_decoded_json @property