bugfix issue 3135
diff --git a/llama_index/output_parsers/selection.py b/llama_index/output_parsers/selection.py
index 54c784d000085..4e8800ed6f0ad 100644
--- a/llama_index/output_parsers/selection.py
+++ b/llama_index/output_parsers/selection.py
@@ -1,8 +1,9 @@
-from dataclasses import dataclass
 import json
+from dataclasses import dataclass
 from typing import Any
 
 from dataclasses_json import DataClassJsonMixin
+
 from llama_index.output_parsers.base import BaseOutputParser, StructuredOutput
 
 
@@ -45,7 +46,26 @@ class Answer(DataClassJsonMixin):
 
 
 class SelectionOutputParser(BaseOutputParser):
+    def _marshal_llm_to_json(self, output: str) -> str:
+        """Extract a valid JSON array from a string.
+        Extracts a substring that represents a valid JSON array.
+
+        Args:
+            output: A string that may contain a valid JSON array surrounded by
+            extraneous characters or information.
+
+        Returns:
+            A string representing a valid JSON array.
+
+        """
+        output = output.strip()
+        left = output.find("[")
+        right = output.rfind("]")
+        output = output[left : right + 1]
+        return output
+
     def parse(self, output: str) -> Any:
+        output = self._marshal_llm_to_json(output)
         json_list = json.loads(output)
         answers = [Answer.from_dict(json_dict) for json_dict in json_list]
         return StructuredOutput(raw_output=output, parsed_output=answers)
diff --git a/tests/output_parsers/test_selection.py b/tests/output_parsers/test_selection.py
index 0ec124dd5e342..ff320e5c39a8d 100644
--- a/tests/output_parsers/test_selection.py
+++ b/tests/output_parsers/test_selection.py
@@ -1,4 +1,5 @@
 import pytest
+
 from llama_index.output_parsers.base import StructuredOutput
 from llama_index.output_parsers.selection import SelectionOutputParser
 
@@ -26,3 +27,24 @@ def test_parse(output_parser: SelectionOutputParser) -> None:
     assert len(parsed.parsed_output) == 2
     assert parsed.parsed_output[0].choice == 1
     assert parsed.parsed_output[0].reason == "just because"
+
+
+def test_parse_non_json_friendly_llm_output(
+    output_parser: SelectionOutputParser,
+) -> None:
+    # https://github.com/jerryjliu/llama_index/issues/3135
+    output = """
+    Output:
+    [
+      {
+        "choice": 1,
+        "reason": "Useful for questions"
+      }
+    ]
+    """
+    parsed = output_parser.parse(output)
+    assert isinstance(parsed, StructuredOutput)
+    assert isinstance(parsed.parsed_output, list)
+    assert len(parsed.parsed_output) == 1
+    assert parsed.parsed_output[0].choice == 1
+    assert parsed.parsed_output[0].reason == "Useful for questions"

fixes issue (includes test)