{
  "id": "code-python-003",
  "skill": "n8n-code-python",
  "name": "Webhook Body Gotcha - Data Under [\"body\"]",
  "description": "Tests understanding that webhook data is nested under [\"body\"] key",
  "query": "I have a Webhook node receiving this JSON:\n\n```json\n{\n  \"name\": \"Alice\",\n  \"email\": \"alice@example.com\",\n  \"age\": 30\n}\n```\n\nIn my Python Code node, I'm trying to access the data:\n\n```python\ndata = _input.first()[\"json\"]\n\nname = data[\"name\"]  # KeyError!\nemail = data[\"email\"]  # KeyError!\n\nreturn [{\"json\": {\"name\": name, \"email\": email}}]\n```\n\nBut I'm getting KeyError. The webhook is receiving data correctly. What's wrong?",
  "expected_behavior": [
    "Immediately recognize this is the webhook .body gotcha",
    "Explain webhook node wraps incoming data under 'body' key",
    "Show the actual structure with headers, params, query, body",
    "Provide corrected code accessing data[\"body\"]",
    "Mention this is a CRITICAL gotcha highlighted in DATA_ACCESS.md",
    "Recommend using .get() for safe access: data.get(\"body\", {})"
  ],
  "expected_output_includes": [
    "[\"body\"]",
    "webhook wraps",
    "nested under body",
    "data.get(\"body\", {})"
  ],
  "correct_code_pattern": "data.get(\"body\", {})",
  "should_emphasize": "This is the MOST COMMON webhook mistake"
}
