Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

fix: response.json() call makes unnecessary memory allocation

Jalil SA19867659f3eb
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