Checking API call response property

I am trying to check if the response property of an api call is true. This is how I am accessing the the response property of the object if(search.result.Response === ‘true’) but its throwing error cannot read property ‘Response’ of undefined. Search is my object and result is where i store the api call response.
Any help appreciated.

I think you are misunderstanding the shape of your data. If the name of your variable is “search” and that is what you are logging out, then you want search.Response.

Another possibility is that this is an async problem and part of that isn’t defined when you’re checking it, but I think we’d need to see the code to help in that case.

I agree seeing the code would be helpful.

BTW, there also seems to be a case mismatch of the strings (‘true’ in the code you posted vs ‘True’ in the screenshot).

Thanks I had a look at the structure of my data and it should’ve been search.Response.