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