I make an Ajax request to a web service and it returns an object.
$(document).ready(function () {
$.ajax({
url: "https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol=MSFT&interval=1min&apikey=*******"
}).then(function (data) {
console.log(JSON.stringify(data));
});
});
In the console I see the object that has a structure similar to the following:
{"Meta Data":{"1. Information":"Intraday (1min) prices and volumes","2. Symbol":"MSFT","3. Last Refreshed":"2018-05-30 16:00:00","4. Interval":"1min","5. Output Size":"Compact","6. Time Zone":"US/Eastern"},"Time Series (1min)":{"2018-05-30 16:00:00":{"1. open":"99.0000","2. high":"99.0500","3. low":"98.9100","4. close":"98.9500","5. volume":"2233252"}, ......
The issue is that I don't know how to access, for example, the value of the field open":"99.0000"
What should I do?
To access json objects you simply have to follow their structure with ".", I'll explain it with the following example:
To access you
fechaFin
should do:Since those
id
of your object have space you can use this other method to access the values:Therefore, to access the data that you want, following the structure that you have passed, you should use the second method: