How to add JSON data this way

How to add JSON data this way

FabrisFabris Posts: 7Questions: 4Answers: 0

I have JSON data in a personalized way, the ID in this case is not merged with the name of the string.
Is it possibile to add this kind of JSON in a simple Datatables grid?
If this is possibile, can I order them using LastName (Last1, 2, 3)?


{"12":{"date_read":"29/07/2022","name_user":"First1 Last1"},
"15":{"date_read":"01/08/2022","name_user":"First2 Last2"},
"22":{"date_read":"15/07/2022","name_user":"First3 Last3"}}


  • colincolin Posts: 14,442Questions: 1Answers: 2,460

    Not as it stands, as the keys are unique for each record - DataTables needs objects to be consistent. You could however convert that object into an array fairly easy in ajax.dataSrc (if it's coming from ajax), or just manipulate it before passing to the DataTables initialisation.


Sign In or Register to comment.