I have JSON object and i want to check key is set in that JSON object
Here is JSON object
var Data_Array = {
"Private": {
"Price": {
"Adult": "18",
"Child": [{
"FromAge": "0",
"ToAge": "12",
"Price": "10"
}]
}
}
}
If JSON Object like this as you can see Child is not exist, then how to check this
var Data_Array = {
"Private": {
"Price": {
"Adult": "18"
}
}
}
I have tried
if(Data_Array.Private.Price.Child[0].Price != "undefined"){
...
}
But it is showing me this error
Uncaught TypeError: Cannot read property
I am not be able to find out what should i do.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With