Skip to main content
Question

External Request JSON Mapping

  • January 23, 2026
  • 8 replies
  • 48 views

tzwai
  • Rising Conversationalist

Below is the JSON body I received from n8n webhook. How do I extract $.output to message CUF?

 

{"type":"begin","metadata":{"nodeId":”abe48e60-73e4e-3303-ac2e-c01d659d6e75c","nodeName":"Respond to Webhook","itemIndex":0,"runIndex":0,"timestamp":1769187565390}}

{"type":"item","content":"{\"humanRequest\":false,\"contactNumber\":\"\",\"output\":\"Business \",\"rawOutput\":\"{\\n  \\\"humanRequest\\\": false,\\n  \\\"phoneNumber\\\": \\\"\\\",\\n  \\\"output\\\": \\\"Business \\\"\\n}\"}","metadata":{"nodeId":"abe28e60-7e4e-4303-ac2e-c01d69d6e75c","nodeName":"Respond to Webhook","itemIndex":0,"runIndex":0,"timestamp":1769187565390}}

{"type":"end","metadata":{"nodeId":”abe48e60-73e4e-3303-ac2e-c01d659d6e75c","nodeName":"Respond to Webhook","itemIndex":0,"runIndex":0,"timestamp":1769187565390}}

 

I was getting different format which was easy to extract out and suddenly JSON body format changed to different format. Is anyone experiencein the same?

8 replies

SumGeniusAI
  • Up-and-Comer
  • January 23, 2026

That's n8n's AI Agent streaming format, the output you need is inside the content field of the item message, but it's double-encoded as a string, not a nested object. You'll need to parse it.

 I'd suggest asking in the n8n community specifically about parsing streaming output from AI Agent nodes, it's a known pain point but the solutions are n8n-version specific.


tzwai
  • Author
  • Rising Conversationalist
  • January 24, 2026

I’ve parsed the output in n8n with below code. But Manychat response showed nested JSON.

Do I need to resolve it at n8n or Manychat?

 


const aiOutput = $input.first().json.output;
const aiOutputCleaned = aiOutput.replace(/```json\n?|\n?```/g, '').trim();
const parsed = JSON.parse(aiOutputCleaned);
return {
  humanRequest: parsed.humanRequest,
  contactNumber: parsed.phoneNumber,
  output: parsed.output,
  rawOutput: aiOutput
};


SumGeniusAI
  • Up-and-Comer
  • January 24, 2026

Resolve it in n8n - ManyChat just receives what you send it.

If ManyChat is still showing nested JSON after your parsing, the issue is likely in how you're passing the data to the ManyChat webhook. Make sure you're sending parsed.output (the string value) and not the whole parsed object.

Can you share what your Respond to Webhook node looks like? That would help pinpoint where the nesting is coming from.


tzwai
  • Author
  • Rising Conversationalist
  • January 24, 2026

Below is the output at the n8n node. I would like to map $.output to message CUF.

[
  {
    "humanRequest": false,
    "contactNumber": "none",
    "output": "AI 🤖👩‍💻 ",
    "rawOutput": "{\n  \"humanRequest\": false,\n  \"phoneNumber\": \"none\",\n  \"output\": \"AI 🤖👩‍💻 \"\n}"
  }
]


SumGeniusAI
  • Up-and-Comer
  • January 24, 2026

n8n side is done, just the ManyChat field mapping now.

Since n8n returns an array, in ManyChat's External Request response mapping use $[0].output to grab the value and assign it to your CUF.


tzwai
  • Author
  • Rising Conversationalist
  • January 24, 2026

Not able to do it. The reason I believe is that the Response in Manychat is nested JSON. 

 

{

"type": "item",

"content": "{\"humanRequest\":false,\"contactNumber\":\"none\",\"output\":\"AI 🤖👩‍💻 ",\"rawOutput\":\"{\\n \\\"humanRequest\\\": false,\\n \\\"phoneNumber\\\": \\\"none\\\",\\n \\\"output\\\": \\\"AI 🤖👩‍💻 \\\"\\n}\"}",

"metadata": {

"nodeId": "abe48e65-7e4e-4203-ac3e-c01d64d6e55c",

"nodeName": "Respond to Webhook",

"itemIndex": 0,

"runIndex": 0,

"timestamp": 1769236062738

}

}


SumGeniusAI
  • Up-and-Comer
  • January 24, 2026

ManyChat is receiving the streaming format instead of your parsed output, those are two different data structures.

Check that your Respond to Webhook node is pulling data from your Code node's output, not directly from the AI Agent. Can you share a screenshot of your workflow connections?


tzwai
  • Author
  • Rising Conversationalist
  • January 24, 2026

yup. sure.. its like this only.