{"record":{"id":"dc50fed70f075387","repo":"run-llama/llama_index","slug":"json-is-invalid","errorCode":null,"errorMessage":"JSON is invalid","messagePattern":"JSON is invalid","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"llama-index-core/llama_index/core/node_parser/file/json.py","lineNumber":81,"sourceCode":"            # Handle invalid JSON input here\n            return []\n\n        json_nodes = []\n        if isinstance(data, dict):\n            lines = [*self._depth_first_yield(data, 0, [])]\n            json_nodes.extend(\n                build_nodes_from_splits([\"\\n\".join(lines)], node, id_func=self.id_func)\n            )\n        elif isinstance(data, list):\n            for json_object in data:\n                lines = [*self._depth_first_yield(json_object, 0, [])]\n                json_nodes.extend(\n                    build_nodes_from_splits(\n                        [\"\\n\".join(lines)], node, id_func=self.id_func\n                    )\n                )\n        else:\n            raise ValueError(\"JSON is invalid\")\n\n        return json_nodes\n\n    def _depth_first_yield(\n        self, json_data: Dict, levels_back: int, path: List[str]\n    ) -> Generator[str, None, None]:\n        \"\"\"\n        Do depth first yield of all of the leaf nodes of a JSON.\n\n        Combines keys in the JSON tree using spaces.\n\n        If levels_back is set to 0, prints all levels.\n\n        \"\"\"\n        if isinstance(json_data, dict):\n            for key, value in json_data.items():\n                new_path = path[:]\n                new_path.append(key)","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-core/llama_index/core/node_parser/file/json.py#L63-L99","documentation":"Error \"JSON is invalid\" thrown in run-llama/llama_index.","triggerScenarios":"Thrown at llama-index-core/llama_index/core/node_parser/file/json.py:81 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Validate the JSON input with json.loads before parsing; fix syntax errors in the source file.","Ensure the file contains a single valid JSON document, not JSONL or truncated content."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"afd0fef371831f9bda13e5af7167cf4e981278ab","analyzedAt":"2026-08-15T05:42:58.429Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}