How to create data table using this Json

How to create data table using this Json

ThiyaneswaranThiyaneswaran Posts: 5Questions: 0Answers: 0

{
"data": [
{
"0": {
"date": "2019-10-03",
"name": "moorthi",
"age": 21
},
"1": {
"date": "2019-10-01",
"name": "thiyanesh",
"age": 21
}
}
]
}

Replies

  • kthorngrenkthorngren Posts: 21,311Questions: 26Answers: 4,948
    edited March 2019

    That is not a data structure supported by Datatables. Datatables expects the row data to be contain within an array. It can be an array of arrays or an array of objects. This doc explains:
    https://datatables.net/manual/data/#Data-source-types

    The above would need to look like this:

    {
        "data": [
            {
                "date": "2019-10-03",
                "name": "moorthi",
                "age": 21
            },
            {
                "date": "2019-10-01",
                "name": "thiyanesh",
                "age": 21
            }
        ]
    }
    

    Kevin

  • ThiyaneswaranThiyaneswaran Posts: 5Questions: 0Answers: 0

    okay i understood

This discussion has been closed.