How to get data from nested array?
How to get data from nested array?
![stereomaniac](https://secure.gravatar.com/avatar/df7ef74422649cf3a16e76ff5204b673/?default=https%3A%2F%2Fvanillicon.com%2Fdf7ef74422649cf3a16e76ff5204b673_200.png&rating=g&size=120)
in General
I used to download data from a json file in this format:
{
"data": [
["n/a","668","01.11.2021 14:16:20", ... ],
["n/a","670","05.11.2021 23:23:54", ...]
]
}
...
"ajax": "first.json",
columns: [
{ data: 0 },
{ data: 1 }
...
And everythig was ok
But now format of my json was changed:
{
"data": {
"deals": [["n/a", "718", "30/11/2021 21:46:14"], ["", "718", "30/11/2021 21:46:14"], ... ],
"stops": [["07/10/2021 21:48:28", "BTCUSDT"], ["07/10/2021 21:48:28", "BTCUSDT"], ... ]
}
}
And I try to get data like this and get "No data available in table":
...
"ajax": "first.json",
columns: [
{ data: 'deals.0' },
{ data: 'deals.1' }
...
How can I get data from new format of json to my table?
Answers
If all you want is
deals
useajax.dataSrc
to point Datatables at this property. For example:Kevin