While working on my project, I encountered an issue with accessing an array inside the response object from an API call using AJAX. Despite numerous attempts, I am unable to retrieve the 'quantity' value of the 'expert' object from the response. It seems like a basic task, yet when I try to directly access and log the particular value in the console, it appears as undefined.
Here is a snippet of my response object:
{
format: "small",
_links: {
self: {
href: "http://www-*******.net/v1/trading/exchange"
}
},
_embedded: {
exchangeData: [
server: {
time: "10:01",
date: "08.12.2014"
},
expert: {
quantity: "48,069",
country: {
..................
The variable that I am trying to access is the 'quantity' value within the 'expert' object. Initially, I attempted to retrieve it using this code:
response._embedded.exchangeData['expert'].quantity
Despite following this approach, the desired value is not being returned. Is this method correct? Accessing such data should typically be simple, so I'm puzzled by this challenge. Thank you for any assistance.