所以,这里的json文件 https://api.coindesk.com/v1/bpi/currentprice/USD.json 我是这样解析json的
library("rjson")
json_file <- "https://api.coindesk.com/v1/bpi/currentprice/USD.json"
json_data <- fromJSON(paste(readLines(json_file), collapse=""))
作为输出我得到
$time
$time$updated
[1] "Sep 16, 2018 11:35:00 UTC"
$time$updatedISO
[1] "2018-09-16T11:35:00+00:00"
$time$updateduk
[1] "Sep 16, 2018 at 12:35 BST"
$disclaimer
[1] "This data was produced from the CoinDesk Bitcoin Price Index (USD). Non-USD currency data converted using hourly conversion rate from openexchangerates.org"
$bpi
$bpi$USD
$bpi$USD$code
[1] "USD"
$bpi$USD$rate
[1] "6,497.5088"
$bpi$USD$description
[1] "United States Dollar"
$bpi$USD$rate_float
[1] 6497.509
我想要结构化的格式。我作为输出必须是
time.updated time.updatedISO time.updateduk X.bpi.USD.rate X.bpi.USD.rate_float
1 16.09.2018 11:35 16.09.2018 11:35:00+00:00 16.09.2018 12:35 6,497.5088 6497.509
这种格式如何解析