---
name: flatten_tree
kind: function
lang: py
domain: core
version: "1.0.0"
purity: pure
signature: "def flatten_tree(structure: Any) -> list[dict]"
description: "Aplana un arbol jerarquico (dict con 'nodes') a lista plana sin hijos. Deep copy de cada nodo."
tags: [tree, flatten, hierarchy, functional, pendiente-usar]
uses_functions: []
uses_types: []
returns: []
returns_optional: false
error_type: ""
imports: [copy]
params:
  - name: structure
    desc: "arbol jerarquico (dict con campo 'nodes' anidado recursivamente)"
output: "lista plana de dicts sin campo 'nodes', deep copy de cada nodo"
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
tree = [{"title": "A", "nodes": [{"title": "A1", "nodes": []}]}]
flatten_tree(tree)
# [{"title": "A"}, {"title": "A1"}]
```

## Notas

Funcion pura. Usa deep copy para no mutar el arbol original. Elimina el campo 'nodes' de cada nodo aplanado.
