jquery - Referencing nested JSON Objects in Datatables -


i have following json:

[        {        "id":"78",         "packaging": "0",         "created_at": "2013-01-28 13:46:41",         "updated_at": "2013-01-28 13:46:41",         "clients": {                       "id": "6",                       "name": "some name",                       "address": "0000000",                       "email":"email@somedomain.com"            }      },      {        "id":"79",         "packaging": "0",         "created_at": "2013-01-28 13:46:41",         "updated_at": "2013-01-28 13:46:41",         "clients": {                       "id": "9",                       "name": "some other name",                       "address": "0000001",                       "email":"email@someotherdomain.com"            }      } ] 

i have verified valid json on jsonlint.com.

i have managed reference unnested data below:

    {"stitle":"id","mdata":"id"},     {"stitle":"created at","mdata":"created_at"},     {"stitle":"updated at.","mdata":"updated_at"}, 

now want able reference clients' name on datatables.

how do using mdata?

try this-

{"stitle":"client id","mdata":"clients.id"}, {"stitle":"client name","mdata":"clients.name"}, {"stitle":"client address","mdata":"clients.address"} 

Comments