Check if a key exists inside a json object

The Solution to Check if a key exists inside a json object is


Try this,

if(thisSession.hasOwnProperty('merchant_id')){

}

the JS Object thisSession should be like

{
amt: "10.00",
email: "[email protected]",
merchant_id: "sam",
mobileNo: "9874563210",
orderID: "123456",
passkey: "1234"
}

you can find the details here

~ Answered on 2013-12-27 16:38:28


Most Viewed Questions: