JSON to XML with calculated value only exports 1 item

Hello dear Community,

I’m trying to calculate a value in the proces of downloading a JSON, and uploading it as an XML to a SFTP server.

So far everything is working, but not changing 1 value.

The steps are:

  1. Connect API and download JSON (parsing on)
  2. Calculate 1 value of the JSON
  3. Create XML
  4. Upload to SFTP.

Without step 2, everything is working fine.
The JSON file comes through to the SFTP like a charm.

But when I try to add the calculation, I can’t add the entire JSON array into the XML anymore and it only Exports 1 item.

So this works (all items are exported):
afbeelding

But when I try to attached the separate fields, only 1 item is exported:

Can someone please explain how I can calculate a value, and add it to the XML, but still all items are exported?

Thank you in advance!

Hey @J_Stouwdam , so the 3. Data.results[].sku variable you are using is an array, which means it would hold multiple items. But placing it in there like this, basically tells the Make platform to grab item 1 (if you don’t put anything between the brackets [ … ] it basically takes [1] by default).

If you want to grab just a single item out of you results, like the SKU, but still have all items you need to:

  • use an “Iterator” to iterate over the results[…] array
  • Then add an “Aggregator” with the output set to the XML module
  • This now allows you to map certain fields inside the aggregator , and still grab all items

Hope this helps you!

4 Likes

Hi @Bjorn.drivn ,

That’s awesome. I’ve had already tried it with the aggregator, but not with the iterator before that!

This works like a charm, thank you for your accurate advice!

3 Likes

Great to hear! Let me know if you have any other questions

2 Likes