displaying nested JSON array
displaying nested JSON array
santoshjoshi
Posts: 3Questions: 0Answers: 0
[code]
{
"Info": {
"VendorID": 1,
"HotelsInfo": [
{
"ID": 100,
"Name": "Test Hotel1",
"BookingInfo": [
{
"BookingDate": "2013-03-05"
}
]
},
{
"ID": 200,
"Name": "Test Hotel2",
"BookingInfo": [
{
"BookingDate": "2013-03-05"
},
{
"BookingDate": "2013-03-06"
}
]
},
{
"Name": "Test Hotel3",
"BookingInfo": [
{
"BookingDate": "2013-03-05"
},
{
"BookingDate": "2013-03-06"
},
{
"BookingDate": "2013-03-07"
}
]
}
]
},
"Status": true,
"Errors": null
}
[/code]
I want to view this like as shown below
---------------------------------
ID Hotel Name BookingDate
______________________________________
100 Test Hotel1 2013-03-05
200 Test Hotel2 2013-03-05
200 Test Hotel2 2013-03-06
300 Test Hotel3 2013-03-05
300 Test Hotel3 2013-03-06
300 Test Hotel3 2013-03-07
------------------------------------
I am using the below configuration, but this is somehow not working
[code]
$('#example').dataTable( {
"sDom": '<"toolbar">
{
"Info": {
"VendorID": 1,
"HotelsInfo": [
{
"ID": 100,
"Name": "Test Hotel1",
"BookingInfo": [
{
"BookingDate": "2013-03-05"
}
]
},
{
"ID": 200,
"Name": "Test Hotel2",
"BookingInfo": [
{
"BookingDate": "2013-03-05"
},
{
"BookingDate": "2013-03-06"
}
]
},
{
"Name": "Test Hotel3",
"BookingInfo": [
{
"BookingDate": "2013-03-05"
},
{
"BookingDate": "2013-03-06"
},
{
"BookingDate": "2013-03-07"
}
]
}
]
},
"Status": true,
"Errors": null
}
[/code]
I want to view this like as shown below
---------------------------------
ID Hotel Name BookingDate
______________________________________
100 Test Hotel1 2013-03-05
200 Test Hotel2 2013-03-05
200 Test Hotel2 2013-03-06
300 Test Hotel3 2013-03-05
300 Test Hotel3 2013-03-06
300 Test Hotel3 2013-03-07
------------------------------------
I am using the below configuration, but this is somehow not working
[code]
$('#example').dataTable( {
"sDom": '<"toolbar">
This discussion has been closed.
Replies
Allan
I was thinking of altering the JSON, but thought there might exists a better solution with the forum.
Regards,
Allan
But my requirement is to show data over multiple rows.
Regards,