---
name: extract_json_from_llm
kind: function
lang: py
domain: core
version: "1.0.0"
purity: pure
signature: "def extract_json_from_llm(content: str) -> dict"
description: "Extrae y parsea JSON de respuestas LLM. Maneja bloques ```json, trailing commas, None->null."
tags: [json, llm, parsing, extraction, pendiente-usar]
uses_functions: []
uses_types: []
returns: []
returns_optional: false
error_type: ""
imports: [json]
params:
  - name: content
    desc: "string con respuesta LLM que contiene JSON (puede estar en bloque ```json)"
output: "dict parseado desde el JSON; dict vacio si no se puede recuperar"
tested: false
tests: []
test_file_path: ""
file_path: "python/functions/core/core.py"
source_repo: "https://github.com/VectifyAI/PageIndex"
source_license: "MIT"
source_file: "pageindex/utils.py"
---

## Ejemplo

```python
raw = '```json\n{"key": "value", "items": [1, 2, 3,]}\n```'
result = extract_json_from_llm(raw)
# {"key": "value", "items": [1, 2, 3]}
```

## Notas

Funcion pura. Maneja errores comunes de LLMs: trailing commas, `None` en lugar de `null`, whitespace extra. Retorna dict vacio si el JSON es irrecuperable.
