How do you check for JSON child node key existence using hasOwnProperty (or other methods) in Flex 4.5?
The hasOwnProperty
method can check for JSON key existence but this seems to only work with top level nodes in a JSON, and not the child nodes. For example, if you have JSON structure like this (in a readable form, sans the JSON syntax), you can check for the existence of callresponder.lastResponse.hasOwnKey("Location")
, but there seems no way to check for Location.VenueName
for example or any of the children:
Name: Location: (child) VenueName: (child) Address: (child) City: (child) State: . . . (etc)
The issue is that my data source omits the child key when the information is not available, so it would be nice to be able to check for the existence of the JSON key in a reference in Flex before doing anything else for it.
The obvious callresponder.lastResponse.hasOwnKey("Location.VenueName")
does not work.
Q: How would I check if the JSON key Location.VenueName
exists?