Converting JSON
-
Has anyone had any luck converting JSON names using the SetKey or Function (Code) options in n8n? I've been trying to convert the following, but it seems to be failing.
Configuration: Cron > Import RSS Feed > SetKey > Output to Directus
{ "postName": "Article Title", "link": "https://blog.com/post-name", "pubDate": "Sun, 19 Jan 2020 01:00:00 -0800", },
"postName" > "title"
"link" > "url"Any help with this would be greatly appreciated!
-
Has anyone had any luck converting JSON names using the SetKey or Function (Code) options in n8n? I've been trying to convert the following, but it seems to be failing.
Configuration: Cron > Import RSS Feed > SetKey > Output to Directus
{ "postName": "Article Title", "link": "https://blog.com/post-name", "pubDate": "Sun, 19 Jan 2020 01:00:00 -0800", },
"postName" > "title"
"link" > "url"Any help with this would be greatly appreciated!
-
@JLX89 I suspect the name of the fields on each side must be the same for the mapping to work ?
@benborges I'm not sure, kind of at a loss. So I basically have it setup like this currently and I've tried both SetKey and RenameKeys:
- Schedule (1 hour)
- Scan RSS Feed
- Attempt Rename
-- SetKey
-- RenameKeys
FROM
{ "postName": "Article Title", "link": "https://blog.com/post-name", "pubDate": "Sun, 19 Jan 2020 01:00:00 -0800", },
TO
{ "title": "Article Title", "url": "https://blog.com/post-name", "pubDate": "Sun, 19 Jan 2020 01:00:00 -0800", },
Thank you!
-
@benborges I'm not sure, kind of at a loss. So I basically have it setup like this currently and I've tried both SetKey and RenameKeys:
- Schedule (1 hour)
- Scan RSS Feed
- Attempt Rename
-- SetKey
-- RenameKeys
FROM
{ "postName": "Article Title", "link": "https://blog.com/post-name", "pubDate": "Sun, 19 Jan 2020 01:00:00 -0800", },
TO
{ "title": "Article Title", "url": "https://blog.com/post-name", "pubDate": "Sun, 19 Jan 2020 01:00:00 -0800", },
Thank you!
-
@martinkbs Perfect, thank you so much!
-
N nebulon marked this topic as a question on
-
N nebulon has marked this topic as solved on