The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"name": "Ejemplos de Expresiones y Transformaciones",
"nodes": [
{
"parameters": {
"values": {
"string": [
{
"name": "datos_ejemplo",
"value": "{\n \"usuarios\": [\n {\"id\": 1, \"nombre\": \"Ana\", \"edad\": 25, \"activo\": true, \"departamento\": \"IT\"},\n {\"id\": 2, \"nombre\": \"Carlos\", \"edad\": 30, \"activo\": false, \"departamento\": \"Ventas\"},\n {\"id\": 3, \"nombre\": \"Mar\u00eda\", \"edad\": 28, \"activo\": true, \"departamento\": \"IT\"},\n {\"id\": 4, \"nombre\": \"Pedro\", \"edad\": 35, \"activo\": true, \"departamento\": \"Marketing\"}\n ],\n \"productos\": [\n {\"id\": 101, \"nombre\": \"Laptop\", \"precio\": 1000, \"categoria\": \"tecnologia\", \"stock\": 5},\n {\"id\": 102, \"nombre\": \"Mouse\", \"precio\": 25, \"categoria\": \"tecnologia\", \"stock\": 100},\n {\"id\": 103, \"nombre\": \"Libro\", \"precio\": 15, \"categoria\": \"educacion\", \"stock\": 0},\n {\"id\": 104, \"nombre\": \"Silla\", \"precio\": 150, \"categoria\": \"oficina\", \"stock\": 20}\n ],\n \"ventas\": [\n {\"fecha\": \"2024-01-15\", \"producto_id\": 101, \"cantidad\": 2, \"vendedor\": \"Ana\"},\n {\"fecha\": \"2024-01-16\", \"producto_id\": 102, \"cantidad\": 5, \"vendedor\": \"Carlos\"},\n {\"fecha\": \"2024-01-17\", \"producto_id\": 104, \"cantidad\": 1, \"vendedor\": \"Mar\u00eda\"}\n ]\n}"
}
]
},
"options": {}
},
"name": "\ud83d\udccb Datos de Ejemplo",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
100,
100
]
},
{
"parameters": {
"values": {
"string": [
{
"name": "usuarios_activos",
"value": "={{ JSON.parse($json.datos_ejemplo).usuarios.filter(u => u.activo) }}"
},
{
"name": "usuarios_it",
"value": "={{ JSON.parse($json.datos_ejemplo).usuarios.filter(u => u.departamento === 'IT') }}"
},
{
"name": "usuario_mayor_30",
"value": "={{ JSON.parse($json.datos_ejemplo).usuarios.filter(u => u.edad > 30) }}"
}
]
},
"options": {}
},
"name": "\ud83d\udd0d Filtros B\u00e1sicos",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
300,
50
]
},
{
"parameters": {
"values": {
"string": [
{
"name": "productos_disponibles",
"value": "={{ JSON.parse($json.datos_ejemplo).productos.filter(p => p.stock > 0) }}"
},
{
"name": "productos_caros",
"value": "={{ JSON.parse($json.datos_ejemplo).productos.filter(p => p.precio > 100) }}"
},
{
"name": "productos_tecnologia",
"value": "={{ JSON.parse($json.datos_ejemplo).productos.filter(p => p.categoria === 'tecnologia') }}"
}
]
},
"options": {}
},
"name": "\ud83d\udecd\ufe0f Filtros de Productos",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
300,
150
]
},
{
"parameters": {
"values": {
"string": [
{
"name": "nombres_usuarios",
"value": "={{ JSON.parse($json.datos_ejemplo).usuarios.map(u => u.nombre) }}"
},
{
"name": "info_usuarios",
"value": "={{ JSON.parse($json.datos_ejemplo).usuarios.map(u => ({ nombre: u.nombre, info: `${u.nombre} (${u.edad} a\u00f1os) - ${u.departamento}` })) }}"
},
{
"name": "productos_resumen",
"value": "={{ JSON.parse($json.datos_ejemplo).productos.map(p => ({ nombre: p.nombre, disponible: p.stock > 0, esBarato: p.precio < 50 })) }}"
}
]
},
"options": {}
},
"name": "\ud83d\udd04 Transformaciones",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
500,
50
]
},
{
"parameters": {
"values": {
"number": [
{
"name": "total_usuarios",
"value": "={{ JSON.parse($json.datos_ejemplo).usuarios.length }}"
},
{
"name": "usuarios_activos_count",
"value": "={{ JSON.parse($json.datos_ejemplo).usuarios.filter(u => u.activo).length }}"
},
{
"name": "edad_promedio",
"value": "={{ JSON.parse($json.datos_ejemplo).usuarios.reduce((sum, u) => sum + u.edad, 0) / JSON.parse($json.datos_ejemplo).usuarios.length }}"
},
{
"name": "precio_total_inventario",
"value": "={{ JSON.parse($json.datos_ejemplo).productos.reduce((sum, p) => sum + (p.precio * p.stock), 0) }}"
}
]
},
"options": {}
},
"name": "\ud83d\udcca Agregaciones",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
500,
150
]
},
{
"parameters": {
"values": {
"string": [
{
"name": "texto_mayusculas",
"value": "={{ 'hola mundo'.toUpperCase() }}"
},
{
"name": "texto_con_formato",
"value": "={{ `Usuario: ${JSON.parse($json.datos_ejemplo).usuarios[0].nombre}` }}"
},
{
"name": "fecha_actual",
"value": "={{ new Date().toISOString().split('T')[0] }}"
},
{
"name": "numero_formateado",
"value": "={{ (1234.56).toFixed(2) }}"
}
]
},
"options": {}
},
"name": "\ud83c\udfa8 Formateo de Datos",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
700,
50
]
},
{
"parameters": {
"values": {
"string": [
{
"name": "validacion_email",
"value": "={{ /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test('usuario@email.com') }}"
},
{
"name": "usuario_existe",
"value": "={{ JSON.parse($json.datos_ejemplo).usuarios.some(u => u.nombre === 'Ana') }}"
},
{
"name": "productos_sin_stock",
"value": "={{ JSON.parse($json.datos_ejemplo).productos.filter(p => p.stock === 0).length > 0 }}"
}
]
},
"options": {}
},
"name": "\u2705 Validaciones",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
700,
150
]
},
{
"parameters": {
"values": {
"string": [
{
"name": "reporte_departamentos",
"value": "={{ JSON.parse($json.datos_ejemplo).usuarios.reduce((acc, u) => { acc[u.departamento] = (acc[u.departamento] || 0) + 1; return acc; }, {}) }}"
},
{
"name": "ventas_por_vendedor",
"value": "={{ JSON.parse($json.datos_ejemplo).ventas.reduce((acc, v) => { acc[v.vendedor] = (acc[v.vendedor] || 0) + v.cantidad; return acc; }, {}) }}"
},
{
"name": "categorias_productos",
"value": "={{ [...new Set(JSON.parse($json.datos_ejemplo).productos.map(p => p.categoria))] }}"
}
]
},
"options": {}
},
"name": "\ud83d\udcc8 An\u00e1lisis Complejo",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
900,
50
]
},
{
"parameters": {
"values": {
"string": [
{
"name": "condicional_simple",
"value": "={{ JSON.parse($json.datos_ejemplo).usuarios[0].edad > 18 ? 'Adulto' : 'Menor' }}"
},
{
"name": "estado_inventario",
"value": "={{ JSON.parse($json.datos_ejemplo).productos.map(p => ({ nombre: p.nombre, estado: p.stock > 10 ? 'Disponible' : p.stock > 0 ? 'Poco Stock' : 'Agotado' })) }}"
},
{
"name": "nivel_usuario",
"value": "={{ JSON.parse($json.datos_ejemplo).usuarios.map(u => ({ nombre: u.nombre, nivel: u.edad < 25 ? 'Junior' : u.edad < 35 ? 'Semi-Senior' : 'Senior' })) }}"
}
]
},
"options": {}
},
"name": "\ud83c\udfaf L\u00f3gica Condicional",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
900,
150
]
},
{
"parameters": {
"values": {
"string": [
{
"name": "buscar_usuario",
"value": "={{ JSON.parse($json.datos_ejemplo).usuarios.find(u => u.nombre.toLowerCase().includes('ana')) }}"
},
{
"name": "producto_especifico",
"value": "={{ JSON.parse($json.datos_ejemplo).productos.find(p => p.id === 102) }}"
},
{
"name": "primera_venta",
"value": "={{ JSON.parse($json.datos_ejemplo).ventas.sort((a, b) => new Date(a.fecha) - new Date(b.fecha))[0] }}"
}
]
},
"options": {}
},
"name": "\ud83d\udd0e B\u00fasquedas",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
1100,
50
]
},
{
"parameters": {
"values": {
"string": [
{
"name": "datos_combinados",
"value": "={{ JSON.parse($json.datos_ejemplo).ventas.map(v => { const producto = JSON.parse($json.datos_ejemplo).productos.find(p => p.id === v.producto_id); return { ...v, producto_nombre: producto?.nombre, precio_unitario: producto?.precio, total: (producto?.precio || 0) * v.cantidad }; }) }}"
},
{
"name": "inventario_actualizado",
"value": "={{ JSON.parse($json.datos_ejemplo).productos.map(p => { const ventas = JSON.parse($json.datos_ejemplo).ventas.filter(v => v.producto_id === p.id); const vendido = ventas.reduce((sum, v) => sum + v.cantidad, 0); return { ...p, vendido, stock_actual: p.stock - vendido }; }) }}"
}
]
},
"options": {}
},
"name": "\ud83d\udd17 Combinaciones",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
1100,
150
]
}
],
"connections": {
"\ud83d\udccb Datos de Ejemplo": {
"main": [
[
{
"node": "\ud83d\udd0d Filtros B\u00e1sicos",
"type": "main",
"index": 0
},
{
"node": "\ud83d\udecd\ufe0f Filtros de Productos",
"type": "main",
"index": 0
}
]
]
},
"\ud83d\udd0d Filtros B\u00e1sicos": {
"main": [
[
{
"node": "\ud83d\udd04 Transformaciones",
"type": "main",
"index": 0
}
]
]
},
"\ud83d\udecd\ufe0f Filtros de Productos": {
"main": [
[
{
"node": "\ud83d\udcca Agregaciones",
"type": "main",
"index": 0
}
]
]
},
"\ud83d\udd04 Transformaciones": {
"main": [
[
{
"node": "\ud83c\udfa8 Formateo de Datos",
"type": "main",
"index": 0
}
]
]
},
"\ud83d\udcca Agregaciones": {
"main": [
[
{
"node": "\u2705 Validaciones",
"type": "main",
"index": 0
}
]
]
},
"\ud83c\udfa8 Formateo de Datos": {
"main": [
[
{
"node": "\ud83d\udcc8 An\u00e1lisis Complejo",
"type": "main",
"index": 0
}
]
]
},
"\u2705 Validaciones": {
"main": [
[
{
"node": "\ud83c\udfaf L\u00f3gica Condicional",
"type": "main",
"index": 0
}
]
]
},
"\ud83d\udcc8 An\u00e1lisis Complejo": {
"main": [
[
{
"node": "\ud83d\udd0e B\u00fasquedas",
"type": "main",
"index": 0
}
]
]
},
"\ud83c\udfaf L\u00f3gica Condicional": {
"main": [
[
{
"node": "\ud83d\udd17 Combinaciones",
"type": "main",
"index": 0
}
]
]
}
}
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Ejemplos de Expresiones y Transformaciones. Manual trigger; 11 nodes.
Source: https://github.com/jorgesislema/apuntes-_de_n8n/blob/864362fca60db8ce8eb5d8546caa648a1897f0fb/plantillas/basicas/04_Ejemplos_de_Expresiones.json — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
26 個 n8n 初學者小技巧,加速 5x 開發時間|🧠 省力知識庫. Manual trigger; 34 nodes.
NextCloud:NextCloud:Folder:create move copy delete list:File:upload move copy download delete. Uses start, nextCloud, readBinaryFile. Manual trigger; 28 nodes.
Transporeon - orders - step 3 - process single. Uses start, functionItem, httpRequest, microsoftSql. Manual trigger; 26 nodes.
This n8n workflow creates a complete recursive copy of any Google Drive folder, preserving the entire folder structure, all files, and sharing permissions. Duplicates folders with unlimited nested sub
Orbit:Member:upsert get update delete getAll lookup:Note:create update getAll:Activity:create getAll:Post:create getAll delete. Uses start, orbit. Manual trigger; 16 nodes.