193
rated 0 times
[
198]
[
5]
/ answers: 1 / hits: 93156
/ 8 Years ago, wed, august 24, 2016, 12:00:00
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.
More From » jquery