I am iterating through a json object and it fails due to an extra element.
see code bellow
{
"rootLayout":"main",
"layoutDescriptions":[
      {
        "type":"Panel",
        "label":"Repeating Groups By Subform",
        "layout":"SimpleForm",
        "content":[
          { "type":"label", "constraint":"newline", "text":"Contacts" },
          { "type":"repeatableGroup", "property":"contacts", "contentRef":"ContactSubForm" }
        ]
      },
      {
        "type":"Panel",
        "label":"",
        "container" : {
          "type":"Panel",
          "layout":"SimpleForm",
          "content":[
            { "type":"label", "constraint":"newline", "text":"Contact Name" },
            { "type":"ListView", "property":"contactName", "listProps":["contactName","telephone","email"] }
          ]
        }
      },
it fails on the second element in the array I am using the following to get my results
data.layoutDescriptions[0].container.content[i].content
I know its stopping because on
data.layoutDescriptions[0].container.content[1].content
it expects
data.layoutDescriptions[0].container.content[1].container.content
so my question is how do I say if container is present do this else do this.
I am trying this at the moment which does not work.
    var contentObjects = data.layoutDescriptions[0].container.content[1].content;
if(contentObjects.container){
                 alert("container exists");
                 }
                         else{
                  alert("nope");
                  }
Thanks.
 
     
    