Child items with the same name in the XML file

Hi, I haven’t found a way to create two items with the same name, does anyone have any ideas on how I can do this?

Hi @LorenzoSbeghen, based on your question I am not quite sure where n8n comes into play here. Do you have existing XML data you want to transform using n8n? Or do you already have JSON data in n8n which you’d like to write into a different XML structure?

Can you share your current data (as text rather than a screenshot) and your existing workflow and confirm which version of n8n you are using?

In general, n8n can create XML data structures without changing the tag name:


When I try to change “ITEM2” to “ITEM” it replaces the structure of the existing “ITEM”, not if this is a json limitation, I need it to come out the same as the first XML. I’m using version 1.0.1 If you analyze I’m using the merge node from the previous version because the merge node of this version didn’t work.

When I try to change “ITEM2” to “ITEM” it replaces the structure of the existing “ITEM”, not if this is a json limitation

Hi @LorenzoSbeghen, this does indeed look like a JSON limitation.

Your ENGENHARIA.ITEM.ESTRUTURA.ITEM.ESTRUTURA field is an object rather than an array. The relevant standard would specify that such values are overwritten:

In the case where there are duplicate name Strings within an object, lexically preceding values for the same key shall be overwritten.

So you’d need to reconsider the data structure you are using here. You could for example consider using an array field holding multiple objects each with an item field like in the example I have provided.


I solved this problem this way, I’m a beginner here is there another way to solve it in a simpler way to get the same result?

Hi @LorenzoSbeghen, if your workflow works and does what you want it to it’s a good workflow I’d say :slight_smile:

As you become more familiar with n8n and JavaScript, you may want to use a single Code node to replace several other nodes, but this is really a matter of personal preference. So don’t worry too much about this.

1 Like

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