{
  "id": "LSZHMsAomkKlMfYR",
  "name": "\ud83d\udcc4 Extract Key Value from JSON - n8n Workflow",
  "tags": [],
  "nodes": [
    {
      "id": "9ef4197b-17d8-42aa-b771-2b151763298a",
      "name": "When clicking \u2018Test workflow\u2019",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -40,
        -20
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "7fa816d2-60e4-42bc-9803-3e49ceb7a4ab",
      "name": "Input JSON Node",
      "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": "Find Key-Value Pair",
      "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": "Key",
      "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": "Value",
      "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,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "fc8d479a-c821-44d1-9b46-f617cbfb5e25",
  "connections": {
    "Key": {
      "main": [
        []
      ]
    },
    "Input JSON Node": {
      "main": [
        [
          {
            "node": "Find Key-Value Pair",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Find Key-Value Pair": {
      "main": [
        [
          {
            "node": "Key",
            "type": "main",
            "index": 0
          },
          {
            "node": "Value",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Test workflow\u2019": {
      "main": [
        [
          {
            "node": "Input JSON Node",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}