Hello all!
I am hoping someone can assist with a solution to an issue I am having displaying a nested array from an API response that creates new row in my table. I tried to format data as an object but I was having issues along with transforming the data.
A sample response from my API is listed below. In the response there are multiple object arrays but one of the key/value pairs in the "Table Items" array has a key named "rows" and sometimes that can have 1 value in the response or multiple values as shown below. Essentially I want each item in the "rows" array to be a separate row in my table. with all the other keys being duplicated.
{
"data": [
{
"body": {
"objects": [
{
"name": "Store #",
"objectType": "field",
"value": "314",
"pageIndex": 0,
"rectangle": [
0,
0,
0,
0
]
},
{
"name": "Invoice #",
"objectType": "field",
"value": "10093230",
"pageIndex": 0,
"rectangle": [
467.625,
136.125,
133.125,
58.125
]
},
{
"name": "Invoice Date",
"objectType": "field",
"value": "3/22/24",
"pageIndex": 0,
"rectangle": [
0,
0,
0,
0
]
},
{
"name": "Order #",
"objectType": "field",
"value": "1"
},
{
"name": "Customer PO",
"objectType": "field",
"value": "15006663-1758885",
"pageIndex": 0,
"rectangle": [
0,
0,
0,
0
]
},
{
"name": "Vendor",
"objectType": "field",
"value": "WHIRLPOOL\n CORPORATION",
"pageIndex": 0,
"rectangle": [
28.125,
214.5,
323.25,
123
]
},
{
"objectType": "table",
"name": "Table Items",
"rows": [
{
"no": {
"pageIndex": 0,
"value": "1"
},
"item": {
"pageIndex": 0,
"value": "MVW4505MW"
},
"description": {
"pageIndex": 0,
"value": "Top Load Washer with Deep Fill - 4.5 cu. ft. cu. ft."
},
"quantity": {
"pageIndex": 0,
"value": "2"
},
"price": {
"pageIndex": 0,
"value": "456"
},
"amount": {
"pageIndex": 0,
"value": "912.00"
}
},
{
"no": {
"pageIndex": 0,
"value": "2"
},
"item": {
"pageIndex": 0,
"value": "NTW4516FW"
},
"description": {
"pageIndex": 0,
"value": "AMANA 3.5 CF. HE TOP LOAD 8 CYCLES WHITE CYCLES WHITE"
},
"quantity": {
"pageIndex": 0,
"value": "4"
},
"price": {
"pageIndex": 0,
"value": "323"
},
"amount": {
"pageIndex": 0,
"value": "1,292.00"
}
}
]
},
{
"name": "Tax",
"objectType": "field",
"value": "0.00",
"pageIndex": 0,
"rectangle": [
0,
0,
0,
0
]
},
{
"name": "Final Total",
"objectType": "field",
"value": "2,204.00",
"pageIndex": 0,
"rectangle": [
0,
0,
0,
0
]
},
{
"name": "Discount Amount",
"objectType": "field",
"value": ""
},
{
"name": "New Total",
"objectType": "field",
"value": "2,204.00",
"pageIndex": 0,
"rectangle": [
0,
0,
0,
0
]
}
],
"elapsed": 0.0518657,
"templateName": "Sample Template",
"templateVersion": "4",
"timestamp": "2024-05-01T03:13:37"
},
"pageCount": 1,
"error": false,
"status": 200,
"name": "64f679fb-4aad-43d2-89dd-3286660c895b_page1.json",
"credits": 42,
"remainingCredits": 17813,
"duration": 111
},
{
"body": {
"objects": [
{
"name": "Store #",
"objectType": "field",
"value": "314",
"pageIndex": 0,
"rectangle": [
0,
0,
0,
0
]
},
{
"name": "Invoice #",
"objectType": "field",
"value": "10093231",
"pageIndex": 0,
"rectangle": [
467.625,
136.125,
133.125,
58.125
]
},
{
"name": "Invoice Date",
"objectType": "field",
"value": "3/22/24",
"pageIndex": 0,
"rectangle": [
0,
0,
0,
0
]
},
{
"name": "Order #",
"objectType": "field",
"value": "1"
},
{
"name": "Customer PO",
"objectType": "field",
"value": "15006671-17595007",
"pageIndex": 0,
"rectangle": [
0,
0,
0,
0
]
},
{
"name": "Vendor",
"objectType": "field",
"value": "ASHLEY\n FURNITURE\n INDUSTRIES",
"pageIndex": 0,
"rectangle": [
28.125,
214.5,
323.25,
123
]
},
{
"objectType": "table",
"name": "Table Items",
"rows": [
{
"no": {
"pageIndex": 0,
"value": "1"
},
"item": {
"pageIndex": 0,
"value": "83905U1"
},
"description": {
"pageIndex": 0,
"value": "Signature Design by Ashley Abinger Sofa and Loveseat- Smoke Sofa and Loveseat- Smoke"
},
"quantity": {
"pageIndex": 0,
"value": "1"
},
"price": {
"pageIndex": 0,
"value": "495.42"
},
"amount": {
"pageIndex": 0,
"value": "495.42"
}
},
{
"no": {
"pageIndex": 0,
"value": "2"
},
"item": {
"pageIndex": 0,
"value": "W446W16"
},
"description": {
"pageIndex": 0,
"value": "Signature Design by Ashley Trinell 72 TV Stand with Electric Fireplace-B TV Stand with Electric Fireplace-B"
},
"quantity": {
"pageIndex": 0,
"value": "1"
},
"price": {
"pageIndex": 0,
"value": "373.82"
},
"amount": {
"pageIndex": 0,
"value": "373.82"
}
}
]
},
{
"name": "Tax",
"objectType": "field",
"value": "0.00",
"pageIndex": 0,
"rectangle": [
0,
0,
0,
0
]
},
{
"name": "Final Total",
"objectType": "field",
"value": "869.24",
"pageIndex": 0,
"rectangle": [
0,
0,
0,
0
]
},
{
"name": "Discount Amount",
"objectType": "field",
"value": ""
},
{
"name": "New Total",
"objectType": "field",
"value": "869.24",
"pageIndex": 0,
"rectangle": [
0,
0,
0,
0
]
}
],
"elapsed": 0.0526737,
"templateName": "Sample Template",
"templateVersion": "4",
"timestamp": "2024-05-01T03:13:37"
},
"pageCount": 1,
"error": false,
"status": 200,
"name": "64f679fb-4aad-43d2-89dd-3286660c895b_page2.json",
"credits": 42,
"remainingCredits": 17813,
"duration": 121
},
{
"body": {
"objects": [
{
"name": "Store #",
"objectType": "field",
"value": "314",
"pageIndex": 0,
"rectangle": [
0,
0,
0,
0
]
},
{
"name": "Invoice #",
"objectType": "field",
"value": "10093231",
"pageIndex": 0,
"rectangle": [
467.625,
136.125,
133.125,
58.125
]
},
{
"name": "Invoice Date",
"objectType": "field",
"value": "3/22/24",
"pageIndex": 0,
"rectangle": [
0,
0,
0,
0
]
},
{
"name": "Order #",
"objectType": "field",
"value": "1"
},
{
"name": "Customer PO",
"objectType": "field",
"value": "15006674-17588857",
"pageIndex": 0,
"rectangle": [
0,
0,
0,
0
]
},
{
"name": "Vendor",
"objectType": "field",
"value": "WHIRLPOOL\n CORPORATION",
"pageIndex": 0,
"rectangle": [
28.125,
214.5,
323.25,
123
]
},
{
"objectType": "table",
"name": "Table Items",
"rows": [
{
"no": {
"pageIndex": 0,
"value": "1"
},
"item": {
"pageIndex": 0,
"value": "WPL6157EBPR"
},
"description": {
"pageIndex": 0,
"value": "Whirlpool Volcano Black 5.3 Cu. Ft. Top Load Washer and 7.0 Cu. Ft. Electric Dryer Top Load Washer and 7.0 Cu. Ft. Electric Dryer"
},
"quantity": {
"pageIndex": 0,
"value": "2"
},
"price": {
"pageIndex": 0,
"value": "1,072"
},
"amount": {
"pageIndex": 0,
"value": "2,144.00"
}
}
]
},
{
"name": "Tax",
"objectType": "field",
"value": "0.00",
"pageIndex": 0,
"rectangle": [
0,
0,
0,
0
]
},
{
"name": "Final Total",
"objectType": "field",
"value": "2,144.00",
"pageIndex": 0,
"rectangle": [
0,
0,
0,
0
]
},
{
"name": "Discount Amount",
"objectType": "field",
"value": ""
},
{
"name": "New Total",
"objectType": "field",
"value": "2,144.00",
"pageIndex": 0,
"rectangle": [
0,
0,
0,
0
]
}
],
"elapsed": 0.049613,
"templateName": "Sample Template",
"templateVersion": "4",
"timestamp": "2024-05-01T03:13:37"
},
"pageCount": 1,
"error": false,
"status": 200,
"name": "64f679fb-4aad-43d2-89dd-3286660c895b_page3.json",
"credits": 42,
"remainingCredits": 17813,
"duration": 113
}
],
"metadata": null,
"value": null
}
This is what I want my table to look like if its possible:
Here is what I want the JSON to look like:
{
"data": [
{
"Store #": "314",
"Invoice #": "10093230",
"Invoice Date": "3/22/2024",
"Order #": "",
"Customer PO": "15006663-1758885",
"Vendor": "WHIRLPOOL\n CORPORATION",
"Item No": "MVW4505MW",
"Descr": "Top Load Washer with Deep Fill - 4.5 cu. ft. cu. ft.",
"QTY Ordered": "",
"QTY Shipped": "2",
"Unit Price": "456",
"Extension": "912",
"Tax": "0",
"Final Total": "2,204.00",
"Discount Amount": "0",
"New total": "2,204.00"
},
{
"Store #": "314",
"Invoice #": "10093230",
"Invoice Date": "3/22/2024",
"Order #": "",
"Customer PO": "15006663-1758885",
"Vendor": "WHIRLPOOL\n CORPORATION",
"Item No": "NTW4516FW",
"Descr": "AMANA 3.5 CF. HE TOP LOAD 8 CYCLES WHITE CYCLES WHITE",
"QTY Ordered": "",
"QTY Shipped": "4",
"Unit Price": "323",
"Extension": "1,292.00",
"Tax": "0",
"Final Total": "2,204.00",
"Discount Amount": "0",
"New total": "2,204.00"
},
{
"Store #": "314",
"Invoice #": "10093231",
"Invoice Date": "3/22/2024",
"Order #": "",
"Customer PO": "15006674-17588857",
"Vendor": "WHIRLPOOL\n CORPORATION",
"Item No": "WPL6157EBPR",
"Descr": "Whirlpool Volcano Black 5.3 Cu. Ft. Top Load Washer and 7.0 Cu. Ft. Electric Dryer Top Load Washer and 7.0 Cu. Ft. Electric Dryer",
"QTY Ordered": "",
"QTY Shipped": "2",
"Unit Price": "1,072",
"Extension": "2,144.00",
"Tax": "0",
"Final Total": "2,144.00",
"Discount Amount": "0",
"New total": "2,144.00"
},
{
"Store #": "314",
"Invoice #": "10093231",
"Invoice Date": "3/22/2024",
"Order #": "",
"Customer PO": "15006671-17595007",
"Vendor": "ASHLEY\n FURNITURE\n INDUSTRIES",
"Item No": "83905U1",
"Descr": "Signature Design by Ashley Abinger Sofa and Loveseat- Smoke Sofa and Loveseat- Smoke",
"QTY Ordered": "",
"QTY Shipped": "1",
"Unit Price": "495.42",
"Extension": "495.42",
"Tax": "0",
"Final Total": "869.24",
"Discount Amount": "0",
"New total": "869.24"
},
{
"Store #": "314",
"Invoice #": "10093231",
"Invoice Date": "3/22/2024",
"Order #": "",
"Customer PO": "15006671-17595007",
"Vendor": "ASHLEY\n FURNITURE\n INDUSTRIES",
"Item No": "W446W16",
"Descr": "Signature Design by Ashley Trinell 72 TV Stand with Electric Fireplace-B TV Stand with Electric Fireplace-B",
"QTY Ordered": "",
"QTY Shipped": "1",
"Unit Price": "373.82",
"Extension": "373.82",
"Tax": "0",
"Final Total": "869.24",
"Discount Amount": "0",
"New total": "869.24"
}
]
}
Any help would be greatly appreciated!
Thanks,