---
name: to_jsonl
kind: function
lang: py
domain: core
version: "1.0.0"
purity: pure
signature: "to_jsonl(rows: list[dict]) -> str"
description: "Serializa a JSON Lines (newline-delimited JSON). Cada dict se serializa como una linea JSON independiente. Util para streaming, logging estructurado y formatos de intercambio."
tags: [jsonl, json, serialization, export, streaming, format]
uses_functions: []
uses_types: []
returns: []
returns_optional: false
error_type: ""
imports: ["json"]
params:
  - name: rows
    desc: "Lista de diccionarios a serializar"
output: "String en formato JSON Lines (newline-delimited JSON)"
tested: true
tests:
  - "lista de dicts jsonl"
  - "valores unicode none nested"
  - "lista vacia retorna string vacio"
  - "cada linea es json parseable"
test_file_path: "python/functions/core/to_jsonl_test.py"
file_path: "python/functions/core/to_jsonl.py"
---

## Ejemplo

```python
rows = [{"id": 1, "name": "Ana"}, {"id": 2, "name": "Bob"}]
jsonl = to_jsonl(rows)
# '{"id": 1, "name": "Ana"}\n{"id": 2, "name": "Bob"}'

# Unicode preservado
rows = [{"emoji": "🔥", "val": None}]
jsonl = to_jsonl(rows)
# '{"emoji": "🔥", "val": null}'
```

## Notas

Usa json.dumps con ensure_ascii=False para preservar Unicode. No incluye newline al final.
Cada linea es un JSON valido independiente, parseable con json.loads.
