Get object values Rest JavaScript


I make a request with Ajax to a web service and this one decuelve an object.

    $(document).ready(function () {
        url: "*******"
    }).then(function (data) {

The object that has a structure similar to the following appears in the console:

{"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 do not know how to access, for example, the value of the open field ":" 99.0000 "

What should I do?

asked by Eduardo 31.05.2018 в 10:05

1 answer


To access json objects you simply have to follow their structure with ".", I'll explain it to you with the following example:

data ={"fecha":{"fechaInicio:"20/02/2017","fechaFin":"20/05/2018"}}

To access fechaFin you should do:


Since the id of your object has space, you can use this other method to access the values:


Therefore, to access the data you want, following the structure that you have passed, you should use the second method:

data["Time Series (1min)"]["2018-05-30 16:00:00"]["1. open"]
answered by 31.05.2018 / 10:21