strJSON= getcontent(url)
data return as below
{"error":{"type":"OAuthException","message":"Error validating access token."}}
Then I can easily retrieve it by
set return= JSON.parse(strJSON)
From here I can easily retrive all the values inside via below
response.write return.error.type
response.write return.error.message
BUT
If I response.write return.error.otherobjectnotexist
It will return error saying Object doesn't support this property or method: 'otherobjectnotexist'
This is fine when I know exactly what are the objects I will get in return.
In real life scenario, we won't know what is returned, what is not. Especially when json return from 3rd party website.
Example, I use facebook connect to retrieve open graph value of a user and return as json.
Some user filled in "gender", so facebook will return this object. Some user never fill in "gender", so facebook will never return this object.
My program by default will response.write return.gender
If I don't have a way to detect whether object exist or not, and ASP directly throw error making whole program stop, it will be troublesome...
Experts! Any way to resolve this issue?