Function for converting array or collection to XML

Hi Makers,

Do you know of any function or way to convert an array / a collection to a XML structure?
I cannot find any way or function for it and it is crucial for my situation (API of application I’m using).

If not - what do you think of such a function? Could it be useful for you? (example below)
I already proposed one function and this one is similar but very different the same time.

having such an input:
[
{
“a”: 1,
“b”: “alfa”,
“c”: [
{
“d”: “2024-01-01”,
“e”: 21.97
}
]
},
{
“a”: 2,
“b”: “beta”,
“c”: [
{
“d”: “2024-02-11”,
“e”: 21.97
},
{
“d”: “2024-02-12”,
“e”: 23.99
}
]
}
]

expecting such output:
[
“<id>1</id><name>alfa</name><pricings><pricing><date>2024-01-01</date><price>21.97</price></pricing></pricings>”,
“<id>2</id><name>beta</name><pricings><pricing><date>2024-02-11</date><price>21.97</price></pricing><pricing><date>2024-02-12</date><price>23.99</price></pricing></pricings>”
]

using such function:
convert_array_to_xml(input, collection_of_mappings);

with additional collection_of_mappings:
{
“a”: “id”,
“b”: “name”,
“c”: [“pricings”,“pricing”],
“d”: “date”,
“e”: “price”
}

Regards,
Johnny

This isn’t XML. This is a JSON string representation of an array with XML strings.

You can try using a Text Aggregator.

Every result (item/record) from a search/match module will output a bundle. To “combine” them into a single structure, you’ll need to use an aggregator of some sort.

Aggregators are modules that accumulate multiple bundles into one single bundle. An example of a commonly-used aggregator module is the Array aggregator module. The next popular aggregator is the Text Aggregator which is very flexible and has applies to many use-cases.

If you need further assistance, please provide the following:

1. Screenshots of module fields and filters

Please share screenshots of relevant module fields and filters in question? It would really help other community members to see what you’re looking at.

You can upload images here using the Upload icon in the text editor:
Screenshot_2023-10-07_111039

2. Scenario blueprint

Please export the scenario blueprint file to allow others to view the mappings and settings. At the bottom of the scenario editor, you can click on the three dots to find the Export Blueprint menu item.

Screenshot_2023-08-24_230826
(Note: Exporting your scenario will not include private information or keys to your connections)

Uploading it here will look like this:

blueprint.json (12.3 KB)

3. And most importantly, Input/Output bundles

Please provide the input and output bundles of the modules by running the scenario (or get from the scenario History tab), then click the white speech bubble on the top-right of each module and select “Download input/output bundles”.
Screenshot_2023-10-06_141025

A.

Save each bundle contents in your text editor as a bundle.txt file, and upload it here into this discussion thread.

Uploading them here will look like this:

module-1-input-bundle.txt (12.3 KB)
module-1-output-bundle.txt (12.3 KB)

B.

If you are unable to upload files on this forum, alternatively you can paste the formatted bundles in this manner:

  • Either add three backticks ``` before and after the code, like this:

    ```
    input/output bundle content goes here
    ```

  • Or use the format code button in the editor:
    Screenshot_2023-10-02_191027

Providing the input/output bundles will allow others to replicate what is going on in the scenario even if they do not use the external service.

Following these steps will allow others to assist you here. Thanks!

2 Likes

Thank you for your time. I guess You didn’t understand my question. I’m writing about function within “Custom Apps” category. I’m not searching for a module.