I need to access the following JSON and have to create check boxes based on number of books in each "options" array in "contents". If i access "ctrl.content = result.data.bookHistory.contents[0].options;" it is reading options array of contents[0] and check boxes are created successfully.In my case two check boxes has been created for two books Predator and Alien. But when i try "ctrl.content = result.data.bookHistory.contents[1].options.action;" no check boxes are created and ctrl.content shows undefined in "console.log(ctrl.content);" . I tried accessing "ctrl.content = result.data.bookHistory.contents[1].options;" also. No luck. Any help would be much appreciated.
JSON
{
"bookhistory" : {
"contents" : [
{
"options" : [
{
"title" : "Predator",
"type" : "CHECKBOX"
},
{
"title" : "Alien",
"type" : "CHECKBOX"
}]
},
{
"options" : [
{
"action" :
{
"title" : "batman",
"type" : "CHECKBOX"
}
}]
}]
}
}