We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
'json' selector type not documented
https://docs.scrapy.org/en/latest/topics/selectors.html

`type defines the selector type, it can be "html", "xml" or None (default).`

But my tests are now failing because it's returning `json` type for actual json docs now.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `scrapy/selector/unified.py`
Content:
```
1 """
2 XPath selectors based on lxml
3 """
4 
5 from typing import Any, Optional, Type, Union
6 
7 from parsel import Selector as _ParselSelector
8 
9 from scrapy.http import HtmlResponse, TextResponse, XmlResponse
10 from scrapy.utils.python import to_bytes
11 from scrapy.utils.response import get_base_url
12 from scrapy.utils.trackref import object_ref
13 
14 __all__ = ["Selector", "SelectorList"]
15 
16 _NOT_SET = object()
17 
18 
19 def _st(response: Optional[TextResponse], st: Optional[str]) -> str:
20     if st is None:
21         return "xml" if isinstance(response, XmlResponse) else "html"
22     return st
23 
24 
25 def _response_from_text(text: Union[str, bytes], st: Optional[str]) -> TextResponse:
26     rt: Type[TextResponse] = XmlResponse if st == "xml" else HtmlResponse
27     return rt(url="about:blank", encoding="utf-8", body=to_bytes(text, "utf-8"))
28 
29 
30 class SelectorList(_ParselSelector.selectorlist_cls, object_ref):
31     """
32     The :class:`SelectorList` class is a subclass of the builtin ``list``
33     class, which provides a few additional methods.
34     """
35 
36 
37 class Selector(_ParselSelector, object_ref):
38     """
39     An instance of :class:`Selector` is a wrapper over response to select
40     certain parts of its content.
41 
42     ``response`` is an :class:`~scrapy.http.HtmlResponse` or an
43     :class:`~scrapy.http.XmlResponse` object that will be used for selecting
44     and extracting data.
45 
46     ``text`` is a unicode string or utf-8 encoded text for cases when a
47     ``response`` isn't available. Using ``text`` and ``response`` together is
48     undefined behavior.
49 
50     ``type`` defines the selector type, it can be ``"html"``, ``"xml"``
51     or ``None`` (default).
52 
53     If ``type`` is ``None``, the selector automatically chooses the best type
54     based on ``response`` type (see below), or defaults to ``"html"`` in case it
55     is used together with ``text``.
56 
57     If ``type`` is ``None`` and a ``response`` is passed, the selector type is
58     inferred from the response type as follows:
59 
60     * ``"html"`` for :class:`~scrapy.http.HtmlResponse` type
61     * ``"xml"`` for :class:`~scrapy.http.XmlResponse` type
62     * ``"html"`` for anything else
63 
64     Otherwise, if ``type`` is set, the selector type will be forced and no
65     detection will occur.
66     """
67 
68     __slots__ = ["response"]
69     selectorlist_cls = SelectorList
70 
71     def __init__(
72         self,
73         response: Optional[TextResponse] = None,
74         text: Optional[str] = None,
75         type: Optional[str] = None,
76         root: Optional[Any] = _NOT_SET,
77         **kwargs: Any,
78     ):
79         if response is not None and text is not None:
80             raise ValueError(
81                 f"{self.__class__.__name__}.__init__() received "
82                 "both response and text"
83             )
84 
85         st = _st(response, type)
86 
87         if text is not None:
88             response = _response_from_text(text, st)
89 
90         if response is not None:
91             text = response.text
92             kwargs.setdefault("base_url", get_base_url(response))
93 
94         self.response = response
95 
96         if root is not _NOT_SET:
97             kwargs["root"] = root
98 
99         super().__init__(text=text, type=st, **kwargs)
100
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/scrapy/selector/unified.py b/scrapy/selector/unified.py
--- a/scrapy/selector/unified.py
+++ b/scrapy/selector/unified.py
@@ -47,7 +47,7 @@
     ``response`` isn't available. Using ``text`` and ``response`` together is
     undefined behavior.
 
-    ``type`` defines the selector type, it can be ``"html"``, ``"xml"``
+    ``type`` defines the selector type, it can be ``"html"``, ``"xml"``, ``"json"``
     or ``None`` (default).
 
     If ``type`` is ``None``, the selector automatically chooses the best type

{"golden_diff": "diff --git a/scrapy/selector/unified.py b/scrapy/selector/unified.py\n--- a/scrapy/selector/unified.py\n+++ b/scrapy/selector/unified.py\n@@ -47,7 +47,7 @@\n     ``response`` isn't available. Using ``text`` and ``response`` together is\n     undefined behavior.\n \n-    ``type`` defines the selector type, it can be ``\"html\"``, ``\"xml\"``\n+    ``type`` defines the selector type, it can be ``\"html\"``, ``\"xml\"``, ``\"json\"``\n     or ``None`` (default).\n \n     If ``type`` is ``None``, the selector automatically chooses the best type\n", "issue": "'json' selector type not documented\nhttps://docs.scrapy.org/en/latest/topics/selectors.html\r\n\r\n`type defines the selector type, it can be \"html\", \"xml\" or None (default).`\r\n\r\nBut my tests are now failing because it's returning `json` type for actual json docs now.\n", "before_files": [{"content": "\"\"\"\nXPath selectors based on lxml\n\"\"\"\n\nfrom typing import Any, Optional, Type, Union\n\nfrom parsel import Selector as _ParselSelector\n\nfrom scrapy.http import HtmlResponse, TextResponse, XmlResponse\nfrom scrapy.utils.python import to_bytes\nfrom scrapy.utils.response import get_base_url\nfrom scrapy.utils.trackref import object_ref\n\n__all__ = [\"Selector\", \"SelectorList\"]\n\n_NOT_SET = object()\n\n\ndef _st(response: Optional[TextResponse], st: Optional[str]) -> str:\n    if st is None:\n        return \"xml\" if isinstance(response, XmlResponse) else \"html\"\n    return st\n\n\ndef _response_from_text(text: Union[str, bytes], st: Optional[str]) -> TextResponse:\n    rt: Type[TextResponse] = XmlResponse if st == \"xml\" else HtmlResponse\n    return rt(url=\"about:blank\", encoding=\"utf-8\", body=to_bytes(text, \"utf-8\"))\n\n\nclass SelectorList(_ParselSelector.selectorlist_cls, object_ref):\n    \"\"\"\n    The :class:`SelectorList` class is a subclass of the builtin ``list``\n    class, which provides a few additional methods.\n    \"\"\"\n\n\nclass Selector(_ParselSelector, object_ref):\n    \"\"\"\n    An instance of :class:`Selector` is a wrapper over response to select\n    certain parts of its content.\n\n    ``response`` is an :class:`~scrapy.http.HtmlResponse` or an\n    :class:`~scrapy.http.XmlResponse` object that will be used for selecting\n    and extracting data.\n\n    ``text`` is a unicode string or utf-8 encoded text for cases when a\n    ``response`` isn't available. Using ``text`` and ``response`` together is\n    undefined behavior.\n\n    ``type`` defines the selector type, it can be ``\"html\"``, ``\"xml\"``\n    or ``None`` (default).\n\n    If ``type`` is ``None``, the selector automatically chooses the best type\n    based on ``response`` type (see below), or defaults to ``\"html\"`` in case it\n    is used together with ``text``.\n\n    If ``type`` is ``None`` and a ``response`` is passed, the selector type is\n    inferred from the response type as follows:\n\n    * ``\"html\"`` for :class:`~scrapy.http.HtmlResponse` type\n    * ``\"xml\"`` for :class:`~scrapy.http.XmlResponse` type\n    * ``\"html\"`` for anything else\n\n    Otherwise, if ``type`` is set, the selector type will be forced and no\n    detection will occur.\n    \"\"\"\n\n    __slots__ = [\"response\"]\n    selectorlist_cls = SelectorList\n\n    def __init__(\n        self,\n        response: Optional[TextResponse] = None,\n        text: Optional[str] = None,\n        type: Optional[str] = None,\n        root: Optional[Any] = _NOT_SET,\n        **kwargs: Any,\n    ):\n        if response is not None and text is not None:\n            raise ValueError(\n                f\"{self.__class__.__name__}.__init__() received \"\n                \"both response and text\"\n            )\n\n        st = _st(response, type)\n\n        if text is not None:\n            response = _response_from_text(text, st)\n\n        if response is not None:\n            text = response.text\n            kwargs.setdefault(\"base_url\", get_base_url(response))\n\n        self.response = response\n\n        if root is not _NOT_SET:\n            kwargs[\"root\"] = root\n\n        super().__init__(text=text, type=st, **kwargs)\n", "path": "scrapy/selector/unified.py"}], "after_files": [{"content": "\"\"\"\nXPath selectors based on lxml\n\"\"\"\n\nfrom typing import Any, Optional, Type, Union\n\nfrom parsel import Selector as _ParselSelector\n\nfrom scrapy.http import HtmlResponse, TextResponse, XmlResponse\nfrom scrapy.utils.python import to_bytes\nfrom scrapy.utils.response import get_base_url\nfrom scrapy.utils.trackref import object_ref\n\n__all__ = [\"Selector\", \"SelectorList\"]\n\n_NOT_SET = object()\n\n\ndef _st(response: Optional[TextResponse], st: Optional[str]) -> str:\n    if st is None:\n        return \"xml\" if isinstance(response, XmlResponse) else \"html\"\n    return st\n\n\ndef _response_from_text(text: Union[str, bytes], st: Optional[str]) -> TextResponse:\n    rt: Type[TextResponse] = XmlResponse if st == \"xml\" else HtmlResponse\n    return rt(url=\"about:blank\", encoding=\"utf-8\", body=to_bytes(text, \"utf-8\"))\n\n\nclass SelectorList(_ParselSelector.selectorlist_cls, object_ref):\n    \"\"\"\n    The :class:`SelectorList` class is a subclass of the builtin ``list``\n    class, which provides a few additional methods.\n    \"\"\"\n\n\nclass Selector(_ParselSelector, object_ref):\n    \"\"\"\n    An instance of :class:`Selector` is a wrapper over response to select\n    certain parts of its content.\n\n    ``response`` is an :class:`~scrapy.http.HtmlResponse` or an\n    :class:`~scrapy.http.XmlResponse` object that will be used for selecting\n    and extracting data.\n\n    ``text`` is a unicode string or utf-8 encoded text for cases when a\n    ``response`` isn't available. Using ``text`` and ``response`` together is\n    undefined behavior.\n\n    ``type`` defines the selector type, it can be ``\"html\"``, ``\"xml\"``, ``\"json\"``\n    or ``None`` (default).\n\n    If ``type`` is ``None``, the selector automatically chooses the best type\n    based on ``response`` type (see below), or defaults to ``\"html\"`` in case it\n    is used together with ``text``.\n\n    If ``type`` is ``None`` and a ``response`` is passed, the selector type is\n    inferred from the response type as follows:\n\n    * ``\"html\"`` for :class:`~scrapy.http.HtmlResponse` type\n    * ``\"xml\"`` for :class:`~scrapy.http.XmlResponse` type\n    * ``\"html\"`` for anything else\n\n    Otherwise, if ``type`` is set, the selector type will be forced and no\n    detection will occur.\n    \"\"\"\n\n    __slots__ = [\"response\"]\n    selectorlist_cls = SelectorList\n\n    def __init__(\n        self,\n        response: Optional[TextResponse] = None,\n        text: Optional[str] = None,\n        type: Optional[str] = None,\n        root: Optional[Any] = _NOT_SET,\n        **kwargs: Any,\n    ):\n        if response is not None and text is not None:\n            raise ValueError(\n                f\"{self.__class__.__name__}.__init__() received \"\n                \"both response and text\"\n            )\n\n        st = _st(response, type)\n\n        if text is not None:\n            response = _response_from_text(text, st)\n\n        if response is not None:\n            text = response.text\n            kwargs.setdefault(\"base_url\", get_base_url(response))\n\n        self.response = response\n\n        if root is not _NOT_SET:\n            kwargs[\"root\"] = root\n\n        super().__init__(text=text, type=st, **kwargs)\n", "path": "scrapy/selector/unified.py"}]}