(Optional) Parse the Source File
Use a parser function to merge 2 feeds, or to modify a feed file that doesn't meet the guidelines, or to perform any other manipulation, duplication, or renaming of values and fields.
Parser functions are required for XML feeds so the feed can be converted into an array inside a JSON.
To add a parser function, go to Advanced Settings › Parser Function and enter your code.
Example: Parse an XML file
function parser(data){
var products = data.items[0].item;
return products.map(function(item){
var newFeedRow = {};
for(var column in item){
newFeedRow[column] = item[column][0];
}
return newFeedRow;
});
}
Example: Merge two feed files
function parse(feed1, feed2) {
var combinedFeeds = feed1.concat(feed2);
return combinedFeeds;
}
Updated 9 months ago