Json filled with array data

Hello,
Now I have a module that takes data that I converted into variables and uploads it to a module via JSON. The problem I have is that today the amount of data is fixed and now I have to do the same but with an array that adds several lines with different product detail (what it adds today is equivalent to a product line).

The first screen is how I have it today and the second screen is how the data is extracted from the tool module.

Now I made it similar with an iterator module that gives me the output like this,

How can I do it with a JSON module as I have it?

HI @ipoblete,

Can you share how your final JSON should look like? I am not entirely sure based on your description on what you want to get.

But, What you can do is(my assumption),

  1. Add an iterator after the current iterator that will iterate over the line items.
  2. Use Text Aggregator, That will create a new JSON for individual items with the source being the new iterator that you have added.
  3. In the Set Variable Module, that you currently have, add the JSON key for Line Items that you need and then pass the text aggregator result that you get from Step 2.

Hope that helps you figure out a way to do this.

1 Like

Hi @Runcorn
thank you for your reply. Json should like this, where in “detalles” I need to add an array with different items. In the example, I added two lines (group of data), first one starting with “codigo”: “100” and second one with “codigo”: “200”,

{
“emisor”: {
“tipodoc”: “39”,
“servicio”: 3
},
“detalles”: [{
“codigo”: “100”,
“nombre”: “cien”,
“cantidad”: “1”,
“precio”: “2”,
“exento”: false
},
{
“codigo”: “200”,
“nombre”: “docientos”,
“cantidad”: “1”,
“precio”: “2”,
“exento”: false
}
],
“pagos”: [{
“mediopago”: “52”,
“monto”: “4”,
“fecha”: “2023-06-28”,
“cobrar”: false
}],
“expects”: “pdf”
}

Best regards,