How can I check if subproducts object exists in my JSON? 
"products":[
    {
    "id":5002,
    "description":"i dont know",
    "position":1,
    "weight":1,
    "subproducts":{
            "name":"test",
            "description":"description of test"
        }
    }
],
It keeps me returning true whenever I use if(product.subproducts) and product.subproduct.name, which cannot read name property undefined.
$.each(company.products, function (j, product) {
    if(product.hasOwnProperty('subproducts') {
       //do something        
    } else {
      // do this
    }
}
UPDATED: forgot to say that, for each products, contains subproducts or not.
 
     
     
    