How can i remove the json key before inserting the json code into n8n

I have AI agent which used to generate n8n workflow based on the requirement.but when i upload it into google drive . it store the code in key value pair.. which is incorrect

Describe the problem/error/question

What is the error message (if any)?

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:
[{"data":"{\n  \"name\": \"YouTube to Twitter & Google Sheets Automation\",\n  \"nodes\": [\n    {\n      \"parameters\": {\n        \"pollTimes\": {\n          \"item\": [\n            {\n              \"mode\": \"everyMinute\",\n              \"minute\": 15\n            }\n          ]\n        },\n        \"feedUrl\": \"=https://www.youtube.com/feeds/videos.xml?channel_id={{$node[\\\"Get Channel ID\\\"].json[\\\"items\\\"][0][\\\"id\\\"]}}\"\n      },\n      \"id\": \"1a2b3c4d-5e6f-7g8h-9i0j-k1l2m3n4o5p6\",\n      \"name\": \"RSS Feed Trigger\",\n      \"type\": \"n8n-nodes-base.rssFeedReadTrigger\",\n      \"typeVersion\": 1,\n      \"position\": [\n        240,\n        300\n      ]\n    },\n    {\n      \"parameters\": {\n        \"resource\": \"channel\",\n        \"operation\": \"getAll\",\n        \"returnAll\": true,\n        \"filters\": {\n          \"forUsername\": \"YOUR_YOUTUBE_USERNAME\"\n        }\n      },\n      \"id\": \"2b3c4d5e-6f7g-8h9i-0j1k-l2m3n4o5p6q7\",\n      \"name\": \"Get Channel ID\",\n      \"type\": \"n8n-nodes-base.youTube\",\n      \"typeVersion\": 1,\n      \"position\": [\n        60,\n        300\n      ],\n      \"credentials\": {\n        \"youTubeOAuth2Api\": {\n          \"id\": \"youtube_credentials\",\n          \"name\": \"YouTube OAuth2 API\"\n        }\n      }\n    },\n    {\n      \"parameters\": {\n        \"text\": \"๐ŸŽฅ New video is live! {{ $json.title }} \\n\\n{{ $json.contentSnippet }}\\n\\n๐Ÿ”— {{ $json.link }}\\n\\n#YouTube #Content #SEO\",\n        \"additionalFields\": {}\n      },\n      \"id\": \"3c4d5e6f-7g8h-9i0j-1k2l-m3n4o5p6q7r8\",\n      \"name\": \"Post to Twitter\",\n      \"type\": \"n8n-nodes-base.twitter\",\n      \"typeVersion\": 1,\n      \"position\": [\n        420,\n        200\n      ],\n      \"credentials\": {\n        \"twitterOAuth1Api\": {\n          \"id\": \"twitter_credentials\",\n          \"name\": \"Twitter OAuth API\"\n        }\n      }\n    },\n    {\n      \"parameters\": {\n        \"operation\": \"append\",\n        \"documentId\": \"YOUR_GOOGLE_SHEET_ID\",\n        \"sheetName\": \"YouTube Content Tracker\",\n        \"columns\": {\n          \"mappingMode\": \"defineBelow\",\n          \"value\": {\n            \"Date\": \"={{ new Date().toISOString().split('T')[0] }}\",\n            \"Video Title\": \"={{ $json.title }}\",\n            \"Video URL\": \"={{ $json.link }}\",\n            \"Published Date\": \"={{ $json.pubDate }}\",\n            \"Description\": \"={{ $json.contentSnippet }}\",\n            \"Status\": \"Posted to Twitter\"\n          }\n        },\n        \"options\": {}\n      },\n      \"id\": \"4d5e6f7g-8h9i-0j1k-2l3m-n4o5p6q7r8s9\",\n      \"name\": \"Add to Google Sheet\",\n      \"type\": \"n8n-nodes-base.googleSheets\",\n      \"typeVersion\": 3,\n      \"position\": [\n        420,\n        400\n      ],\n      \"credentials\": {\n        \"googleSheetsOAuth2Api\": {\n          \"id\": \"google_sheets_credentials\",\n          \"name\": \"Google Sheets OAuth2 API\"\n        }\n      }\n    },\n    {\n      \"parameters\": {\n        \"conditions\": {\n          \"string\": [\n            {\n              \"value1\": \"={{ $json.title }}\",\n              \"operation\": \"isNotEmpty\"\n            }\n          ]\n        }\n      },\n      \"id\": \"5e6f7g8h-9i0j-1k2l-3m4n-o5p6q7r8s9t0\",\n      \"name\": \"Check if New Video\",\n      \"type\": \"n8n-nodes-base.if\",\n      \"typeVersion\": 1,\n      \"position\": [\n        320,\n        300\n      ]\n    }\n  ],\n  \"connections\": {\n    \"Get Channel ID\": {\n      \"main\": [\n        [\n          {\n            \"node\": \"RSS Feed Trigger\",\n            \"type\": \"main\",\n            \"index\": 0\n          }\n        ]\n      ]\n    },\n    \"RSS Feed Trigger\": {\n      \"main\": [\n        [\n          {\n            \"node\": \"Check if New Video\",\n            \"type\": \"main\",\n            \"index\": 0\n          }\n        ]\n      ]\n    },\n    \"Check if New Video\": {\n      \"main\": [\n        [\n          {\n            \"node\": \"Post to Twitter\",\n            \"type\": \"main\",\n            \"index\": 0\n          },\n          {\n            \"node\": \"Add to Google Sheet\",\n            \"type\": \"main\",\n            \"index\": 0\n          }\n        ]\n      ]\n    }\n  },\n  \"active\": true,\n  \"settings\": {},\n  \"versionId\": \"1.0.0\",\n  \"id\": \"youtube-twitter-sheets-automation\",\n  \"meta\": {\n    \"instanceId\": \"n8n-instance\"\n  },\n  \"tags\": [\n    {\n      \"id\": \"marketing\",\n      \"name\": \"Marketing\"\n    },\n    {\n      \"id\": \"seo\",\n      \"name\": \"SEO\"\n    },\n    {\n      \"id\": \"youtube\",\n      \"name\": \"YouTube\"\n    }\n  ]\n}"}]

Hey @Nirupam_Das welcome to the community. What is your question?

The output you want itโ€™s in the data

So you want to upload a json of the generated workflow.

After the AI Agent. You need to get the data first.

Use a set field node to extract the $json.data first and check if that is the valid json.

Then store it as a json file.

1 Like

Thanks for the reply.

i attached the flow.

AI agent generate the n8n flow in json format. while convert to json to file. data (key) also comes inside the content which i dont need.. i need only the n8n workflow content.

Hi @Zelite i need only the content of the n8n workflow generated by ai agent. u can see the screenshot. when i convert to json . โ€œdataโ€ get add in the json file as key.. which is incorrect.

Hi @darrell_tw pls find the screenshot

Give you a more simple example about it.

After the output from AI Agent

We need to get the json string and turn into JSON obejct

After the parse. We can make it as a json file and upload it to google drive.

make sure you see the binary file first and then you can upload to google drive

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.