📄 Extraire les paires clé-valeur à partir de JSON - Workflow n8n
Ceci est unEngineeringworkflow d'automatisation du domainecontenant 5 nœuds.Utilise principalement des nœuds comme Set, Code, ManualTrigger. Outil JSON : extraire des paires clé-valeur par index
- •Aucun prérequis spécial, prêt à l'emploi après importation
Nœuds utilisés (5)
Catégorie
{
"id": "LSZHMsAomkKlMfYR",
"meta": {
"instanceId": "14e4c77104722ab186539dfea5182e419aecc83d85963fe13f6de862c875ebfa"
},
"name": "📄 Extract Key Value from JSON - n8n Workflow",
"tags": [],
"nodes": [
{
"id": "9ef4197b-17d8-42aa-b771-2b151763298a",
"name": "En cliquant sur 'Tester le workflow'",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-40,
-20
],
"parameters": {},
"typeVersion": 1
},
{
"id": "7fa816d2-60e4-42bc-9803-3e49ceb7a4ab",
"name": "Nœud Input JSON",
"type": "n8n-nodes-base.set",
"position": [
140,
-20
],
"parameters": {
"mode": "raw",
"options": {},
"jsonOutput": "{\n \"myData\": {\n \"name\": \"Alice\",\n \"age\": \"30\",\n \"city\": \"Paris\"\n },\n \"rowIndex\": \"1\"\n}\n\n"
},
"typeVersion": 3.4
},
{
"id": "c2a948b4-65b5-490d-8e4c-cdb6b39ad70e",
"name": "Trouver la paire clé-valeur",
"type": "n8n-nodes-base.code",
"position": [
340,
-20
],
"parameters": {
"language": "python",
"pythonCode": "import json\nans=[]\nind = (_input.first().json.rowIndex)\nind=int(ind)\n\nfor i in _input.first().json.myData:\n if ind==0:\n ans.append(i)\n ans.append(_input.first().json.myData[i])\n break\n ind=ind-1\n\n# Return in valid n8n format\nreturn [{\"json\": {\"result\": ans}}]\n\n\n\n\n"
},
"typeVersion": 2,
"alwaysOutputData": true
},
{
"id": "c2f94136-8254-44b6-abe2-39caa814b036",
"name": "Clé",
"type": "n8n-nodes-base.set",
"position": [
600,
-140
],
"parameters": {
"options": {
"dotNotation": false,
"ignoreConversionErrors": true
},
"assignments": {
"assignments": [
{
"id": "243bbcc4-ff8a-4af5-b80b-96c524d33118",
"name": "result",
"type": "array",
"value": "={{ $json.result[0] }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "1e6f42da-e376-463b-acc5-37a5454d55d3",
"name": "Valeur",
"type": "n8n-nodes-base.set",
"position": [
600,
120
],
"parameters": {
"options": {
"dotNotation": false,
"ignoreConversionErrors": true
},
"assignments": {
"assignments": [
{
"id": "5b20ed91-93b0-45b4-b555-5d7a3cff672e",
"name": "result[1]",
"type": "string",
"value": "={{ $json.result[1] }}"
}
]
}
},
"typeVersion": 3.4
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "fc8d479a-c821-44d1-9b46-f617cbfb5e25",
"connections": {
"c2f94136-8254-44b6-abe2-39caa814b036": {
"main": [
[]
]
},
"7fa816d2-60e4-42bc-9803-3e49ceb7a4ab": {
"main": [
[
{
"node": "c2a948b4-65b5-490d-8e4c-cdb6b39ad70e",
"type": "main",
"index": 0
}
]
]
},
"c2a948b4-65b5-490d-8e4c-cdb6b39ad70e": {
"main": [
[
{
"node": "c2f94136-8254-44b6-abe2-39caa814b036",
"type": "main",
"index": 0
},
{
"node": "1e6f42da-e376-463b-acc5-37a5454d55d3",
"type": "main",
"index": 0
}
]
]
},
"9ef4197b-17d8-42aa-b771-2b151763298a": {
"main": [
[
{
"node": "7fa816d2-60e4-42bc-9803-3e49ceb7a4ab",
"type": "main",
"index": 0
}
]
]
}
}
}Comment utiliser ce workflow ?
Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.
Dans quelles scénarios ce workflow est-il adapté ?
Débutant - Ingénierie
Est-ce payant ?
Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.
Workflows recommandés
WeblineIndia
@weblineindiaA Leading Software Engineering, Consulting & Outsourcing Services Company in USA & India serving Clients Globally since 1999.
Partager ce workflow