JSON to XML Node "Array Item Name: " not updating output

Hello all,

I’m running into trouble in converting a JSON to an XML using the “JSON to XML” Node. I am attempting to name elements from the JSON array to something specific, which seems to be what the option “Array Item name:” is for. Regardless of what I try, the default “item” seems to persist. I’ve attached the simplest version of the problem below.

JSON to XML error.knwf (74.0 KB)

Welcome to the Forum!

i’m not sure I understand what you hope the Array Item Name will do. It appears to me that it is the key for which the array of elements is the value. If you check the box below it, then the resulting xml will instead make each element its own value.

When you say that you want to name the elements, do you mean that you want to have different keys for each value? Do you mean that you want to change the values?

1 Like

Thank you for the response!

What I originally wanted was to rename the XML tags for each item in the JSON Array. For example, instead of the resulting XML looking like

<product_array>
<item></item>
<item></item>
<item></item>
</product_array>

I wanted to be able to choose the name of the tags to some other set name instead of “item”.

<product_array>
<product></product>
<product></product>
<product></product>
</product_array>

That’s what I thought the field “Array item name” would achieve, but it seems like I’ve misunderstood. What I ended up doing as a substitute was using string manipulation and replacing all of the “item” with new values.

Thank you for the details. Depending on the complexity of your JSON, you might be able to use the checkbox together with a different name for the root.

1 Like

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