I am checking if a JSON object contains a specific property.
I have this JSON document:
{
    "market_name": "Dakar",
    "market_description": "Tambacounda Market N1",
    "localization_id": 2,
    "long": 13.776796,
    "lat": -13.672198,
    "country": "Senegal",
    "regione": {
        "@nil": "true"
    },
    "province": {
        "@nil": "true"
    },
    "city": {
        "@nil": "true"
    },
    "district": {
        "@nil": "true"
    },
    "town": {
        "@nil": "true"
    },
    "village": {
        "@nil": "true"
    },
    "commoditiesList": {
        "commodity": [{
            "commodity_details_id": 8,
            "commodity_name_en": "Carrot",
            "commodity_name": "Carrot",
            "description": "Carrot",
            "image_link": "https://firebasestorage.googleapis.com/v0/b/fao-digital-services-portfolio.appspot.com/o/img%2Ficons%2Fagrimarket%2Fcommodity%2Fcarrot.png?alt=media&token=f295c6b3-abf8-4b51-97c9-582d9188675f",
            "market_commodity_details_id": 26,
            "price_series_id": 9,
            "last_price_date": "2017-12-18+01:00",
            "last_avg_price": 48.37,
            "currency": "XOF",
            "measure_unit": "kilogram"
        },
        {
            "commodity_details_id": 4,
            "commodity_name_en": "Red onion",
            "commodity_name": "Red onion",
            "description": "Red onion",
            "image_link": "https://firebasestorage.googleapis.com/v0/b/fao-digital-services-portfolio.appspot.com/o/img%2Ficons%2Fagrimarket%2Fcommodity%2Fonion-red.png?alt=media&token=4ec9de4e-6e5a-4198-9bcd-21b692760618",
            "market_commodity_details_id": 24,
            "price_series_id": 11,
            "last_price_date": "2017-12-18+01:00",
            "last_avg_price": 33.33,
            "currency": "XOF",
            "measure_unit": "kilogram"
        },
        {
            "commodity_details_id": 6,
            "commodity_name_en": "Green Beans",
            "commodity_name": "Green Beans",
            "description": "Green Beans",
            "image_link": "https://firebasestorage.googleapis.com/v0/b/fao-digital-services-portfolio.appspot.com/o/img%2Ficons%2Fagrimarket%2Fcommodity%2Fgreen_beens.png?alt=media&token=5022f2c8-5751-4dd3-b695-2518e9586943",
            "market_commodity_details_id": 25,
            "price_series_id": 17,
            "last_price_date": "2017-12-18+01:00",
            "last_avg_price": 778,
            "currency": "XOF",
            "measure_unit": "kilogram"
        }]
    }
}
I want to check if in this JSON document exist the commodity array into the commodityList object.
If I try to use this expression:
response.hasOwnProperty('commoditiesList.commodity')
it returns false and I can't understand why.
Testing on the commoditiesList wrapper object:
 response.hasOwnProperty('commoditiesList') 
it works fine.
What am I missing?
 
     
     
    