user1234 user1234 - 1 year ago 96
JSON Question

Returns undefined on a object prop even though it exsits-JS

I'm having the same issue as mentioned here: Can't access object property, even though it exists. Returns undefined

However in my case it's a property with
, where
comes in as full object and
is shown undefined when its actually present in the json object, here's how it looks:

enter image description here

enter image description here

As you can see, I'm trying to access the
(at the very end) from the object and it throws undefined. I tried
, not working…

I also tried the solution mentioned in that post but nothing helped.
Any ideas on this one?

Answer Source

I think you should access that property like this.hostAsset[""] because of the . in the property name, so it wouldn't try to access the property id from some qgUserHost object.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download