I'm trying to get a data from http://api.coindesk.com/v1/bpi/currentprice/usd.json here which looks like this
{
"time": {
"updated": "Jan 18, 2017 02:55:00 UTC",
"updatedISO": "2017-01-18T02:55:00+00:00",
"updateduk": "Jan 18, 2017 at 02:55 GMT"
},
"disclaimer": "This data was produced from the CoinDesk Bitcoin Price Index (USD). Non-USD currency data converted using hourly conversion rate from openexchangerates.org",
"bpi": {
"USD": {
"code": "USD",
"rate": "888.9525",
"description": "United States Dollar",
"rate_float": 888.9525
}
}
}
and the data i want to get is only "bpi"."USD"."rate" part but i'm unavailable to do so.
$.getJSON("demo_ajax_json.js", function(result){
$.each(result, function(i, field){
$("div").append(field + " ");
});
});
I'm trying to put it here but i'm having a problems because of "stacked?" keys and values. Can someone direct me to the right way? If i understand correctly i have JSON.parse but still i don't completely understand it
[object Object] This data was produced from the CoinDesk Bitcoin Price Index (USD). Non-USD currency data converted using hourly conversion rate from openexchangerates.org [object Object]@A.J