Nested Object
Nested Object

Hi,
I am reciveing nested data from API, see the consloe log image below
I am trying to load data
"columns": [
{ "data": "cart.0.productId" },
{ "data": "cart.0.productTitle" },
{ "data": "cart.0.quantity" },
Also tried
"columns": [
{ "data": "productId" },
{ "data": "productTitle" },
{ "data": "quantity" },
But both of the approaches not working. Any idea what I am doing wrong here. I have looked in to the examnple but still could not figure it out.
Thanks
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
you could use data source to point to "data.cart" as the data source as opposed to using "data".
https://datatables.net/reference/option/ajax.dataSrc
This has a hint, too:
https://datatables.net/examples/ajax/custom_data_flat.html
Perfect
Thanks a lot .