Arrays of arrays or arrays of object ?

Arrays of arrays or arrays of object ?

Arden54Arden54 Posts: 39Questions: 4Answers: 0

Hi,
I'm trying to display datatables with data from my database. The json response looks like this :
{"data":[["pineapple","1","1","1",null,"09\/Jan\/18"],["tomato","2","1","2",null,"31\/Jan\/11"],["banana","3","2","1","test","01\/Jan\/20"]]}
Is that an arrays of arrays or arrays of object ? If it is an array of arrays, can you affirm that I don't have to put "columns" : [column names] please ?

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 1,193Questions: 0Answers: 226
    Answer ✓

    Hi @Arden54 ,

    Yep, the square brackets mean it's an array of arrays, so yep, you don't need to specify the columns. See the example here, on the Ajax tab, this data is like yours.

    Cheers,

    Colin

  • Arden54Arden54 Posts: 39Questions: 4Answers: 0

    Hi, thanks for answer ! I just have a little question, where do you put the directory "data" ? I'm on Symfony3. I tried to put it in the web directory but it seems not to be recognized :(

  • Nancy20Nancy20 Posts: 8Questions: 1Answers: 0

    Nevermind, as I'm using a function to get data from my DB I'm not gonna use the "data/arrays.txt". Thanks anyway for the answer ;)

  • colincolin Posts: 1,193Questions: 0Answers: 226

    Guessing you have two accounts (Nancy/Arden) :)

  • Arden54Arden54 Posts: 39Questions: 4Answers: 0

    Right, I had a problem with my first account that's why I created a second but there is no more problems now that's why I have 2 ^^

Sign In or Register to comment.