I am making an API call to Carbone which basically just creates a PDF based off a user created format in a text editor.
I am building my JSON data that populates the PDF based off of rows that I have in a table. The issue is, the number of rows in the table are dynamic (sometimes there are 2 rows sometimes there are 20 rows) depending on how users fill out information.
I need to be able to dynamically generate my JSON based on how many rows are in the table.
I've attached an image of my table as well as an example of an object (row) that is being sent in an API call.
An example of a row being passed as JSON is below:
"products": [{
"name": {{tableHours.data.firstName[0]
"priceUnit": {{query_GetRates.data.rate[0]}},
"quantity": {{Math.round(tableHours.data.sum_time[0]/3600000 * 100)/100}},
"priceTotal": {{Math.round(tableHours.data.sum_time[0]/3600000 * 100)/100 *
query_GetRates.data.rate[0]}}
}]
Which turns into
[{
name: Jason
priceUnit: 10,
quantity: 17.14,
priceTotal": 171.4}],