开发者

How to represent this JSON into a table

I got this JSON and I want to use DataTables or Flexigrid to represent it into a table. I've tried but with not success. I thought into a custom JSON formater to extract just some data and get it work with DataTable.

I need ideas or other approach.

PS. This is only a part of the JSON.

How to represent this JSON into a table

The complete JSON object:

{"tipoGuia":1,"valida":"23-09-2011","procesada":0,"solicitante":{"cedula":"V22198793","nombre":"JOSE MEDINA"},"propietario":{"cedula":"V-23240257","nombre":"Jose","apellido":"Reyes M.","telefono":null},"unidadP":{"id":"157","nombre":"Fundo Nieto","rna":"s/n","sector":"Via Ppal. Las Rocas (Las Tapias)","municipio":"Rivas Davila"},"cosecha":{"idInspeccion":"a369ba59","idCosecha":"732ecc26","token":"f3490950310830fc6083d73eb6cf6439","variedad":"Crio开发者_Python百科llo","cosechado":"0.2","produccion":"140","restante":"200","sembrada":"0.2","transportado":"45","rubro":"Ajo"},"transportista":{"cedula":"V17769062","nombre":"Luis Eduardo","apellido":"Ceballos","placa":"71fmao","marca":"IVECO","modelo":" PEGASO","capacidad":"10","remolque":"S/N","origen":"Mérida","municipio_origen":"Rivas Dávila","destino":"Aragua","municipio_destino":"Jose Angel Lamas","sitiodestino":"mercamer"}}


You can map columns to the properties of objects using the aoColumns parameter something like:

"aoColumns": [
        { "mDataProp": "valida" },
        { "mDataProp": "procesada" },
        { "mDataProp": "solicitante.celula" },
        { "mDataProp": "solicitante.nombre" }
    ]

See example on the http://datatables.net/release-datatables/examples/ajax/deep.html. Note that you will need to wrap your JSON with aaData array:

{
   "aaData": [

   ]
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜