Repeating group to json array

Hi All,

In an API post call I have the following JSON:

{
 "clientnr": <klantnummer>,
 "reference":
 {
 "line1": "<referentie_line1>",
 "line2": "<referentie_line2>",
 "line3": "<referentie_line3>"
 },
 "lines": [
 {
 "amount": 1,
 "amount_desc": "test",
 "description": "beschrijving",
 "tax_rate": 21,
 "price": 123
 },
 {
 "amount": 5,
 "amount_desc": "test2",
 "description": "beschrijving2",
 "tax_rate": 21,
 "price": 23.25
 }
 ],
 "description": "<beschrijving>",
 "action": "send",
 "sendmethod": "email"
} 

The lines variable contains an array of product lines.

Within my front-end application I have a repeating group listing the products:

When I press the ‘create invoice’ button the “lines” array in the json need to be filled with as many products as stated in the ‘amount’ field, when no amount is raised the product should be left out ofcourse.

How do I accomplish this?

Thanks!

2 Likes

I’m one step further:

How Can I join the red texts in one comma separated line outside the repeating group using the ‘Create Invoice’ button?

1 Like