Describe the problem/error/question
When using the Set node for for saving needed fields with JSON mode and expression interpolation (e.g., {{ $json.caption }}
), I’m seeing an issue where unexpected quotation marks are injected into the output, even when the original input does not contain them.
This happens most commonly when the caption contains a colon. For example, the word realize in the example below in the sentence gets surrounded by quotes automatically, making the JSON invalid.
I’ve tried hardcording it with JS code, like turnign it into string, and removign the quotation marks, but it still keeps on placing them there.
I believe this is a bug in how n8n handles templated strings in JSON mode inside the SET node.
What is the error message (if any)?
The ‘JSON Output’ in item 0 contains invalid JSON
Please share your workflow
I uploaded the iamge of the output, we can see the original input somewhere in the middle of the output JSON file, which has no issues, but the top part, unexpectedly adds quotation marks in different areas such as:
-
Input JSON: “caption”: “Everyone takes different amounts of time to realize: no one is coming to save you. and many never figure it out until it’s too late.”
Output JSON: “caption”: “Everyone takes different amounts of time to “realize”: no one is coming to save you. and many never figure it out until it’s too late.” -
Input JSON: “postedAt”: “2025-04-19T15:55:00.000Z”,
Output JSON: “postedAt”: “2025-04-“19T15”:“55”:00.000Z”, -
Post Url does the same and Video URL does the same (not going to put it here as they are too long)
Share the output returned by the last node
{
"username": "hormozi",
"fullName": "Alex Hormozi",
"caption": "Everyone takes different amounts of time to realize: no one is coming to save you. and many never figure it out until it’s too late.",
"hashtags": "[]",
"likes": 6529,
"comments": 150,
"topComment": "Your destiny is in your hands💪🏾",
"videoViews": 48007,
"videoPlays": 231023,
"videoDurationSec": 5,
"postedAt": "2025-04-19T15:55:00.000Z",
"postUrl": "https://www.instagram.com/p/DIokonBpRzG/",
"thumbnailUrl": "https://instagram.fgru6-1.fna.fbcdn.net/v/t51.2885-15/491041528_18275132860250343_3966867281092633759_n.jpg?stp=dst-jpg_e35_p1080x1080_sh0.08_tt6&_nc_ht=instagram.fgru6-1.fna.fbcdn.net&_nc_cat=103&_nc_oc=Q6cZ2QHz59t_zLOquyxZotFT4yVrPjSKb5LOiGKh6h_Im0ZLpXHdta_Qal8WailTGK_95vA&_nc_ohc=sPxf3FblzosQ7kNvwG9D9Yw&_nc_gid=mkjwnl-INiK8nPsiCCfc6w&edm=APs17CUBAAAA&ccb=7-5&oh=00_AfFtCVGLoScudMaX93RYGsgkcLbzgqFKWraXzXuweo4-7A&oe=6809E693&_nc_sid=10d13b",
"videoUrl": "https://instagram.fgru6-1.fna.fbcdn.net/o1/v/t16/f2/m86/AQMS_ASHCXdDL050PJgrQekm0BQsp4Yn4dwd624ioh3eFvK1mqDWXRl7tVMYUz8wsQrnHIa5PPz7j5xfvmXxuxsnM8kQv_RWmYm5ZEw.mp4?stp=dst-mp4&efg=eyJxZV9ncm91cHMiOiJbXCJpZ193ZWJfZGVsaXZlcnlfdnRzX290ZlwiXSIsInZlbmNvZGVfdGFnIjoidnRzX3ZvZF91cmxnZW4uY2xpcHMuYzIuNzIwLmJhc2VsaW5lIn0&_nc_cat=109&vs=1635664740452540_3683779682&_nc_vs=HBkcFQIYUmlnX3hwdl9yZWVsc19wZXJtYW5lbnRfc3JfcHJvZC80RjQ5MzBBRkJCNzlEOEVDQTZENEJDN0JERUU3REZBQl92aWRlb19kYXNoaW5pdC5tcDQVAALIAQAoABgAGwAVAAAmmPCb4qHBzT8VAigCQzMsF0AUAAAAAAAAGBJkYXNoX2Jhc2VsaW5lXzFfdjERAHX%2BBwA%3D&_nc_rid=085af8707a&ccb=9-4&oh=00_AfF2Zu4v4xjZoEAWerhNAaNlaquTzZaTcXxECM-Ov4yg9Q&oe=68062098&_nc_sid=10d13b"
}
Should be whatever the Original output is.
Information on your n8n setup
- **n8n version: ** 1.84.1
- **Database (default: SQLite): ** Excel currently
- **n8n EXECUTIONS_PROCESS setting (default: own, main): ** main
- **Running n8n via (Docker, npm, n8n cloud, desktop app): ** n8n Cloud
- **Operating system:**n8n Cloud (Managed, Linux-based)