更新时间:2023-01-17 16:04:54
readLines
返回字符向量. apply
需要一个数组.使用lapply
或类似的东西.
readLines
is returning a character vector. apply
expects an array. Use lapply
or something similar.
out <- lapply(readLines("test.txt"), fromJSON)
> head(out[[1]])
$business_id
[1] "rncjoVoEFUJGCUoC1JgnUA"
$full_address
[1] "8466 W Peoria Ave\nSte 6\nPeoria, AZ 85345"
$open
[1] TRUE
$categories
[1] "Accountants" "Professional Services" "Tax Services"
[4] "Financial Services"
$city
[1] "Peoria"
$review_count
[1] 3