Friday 2 June 2017

missing value from json object when writing if condition it's througing an error

my JSON Object is varies based on some conditins. when i am trying to access the value from json object when it is not present it's througing an error message saying that value is not defined. How to avoid such kind of situations??

IntentSlots: '{"cnumberslot":{"name":"cnumberslot","value":"C186206"}}' - condition works perfectly.

IntentSlots: '{"cnumberslot":{"name":"cnumberslot"}}' } - throws an error.

my condition is like below,

if(IntentSlots.cnumberslot.value !== ""){ }



via abhishek

No comments:

Post a Comment