如何提取项目3如果我有一个嵌套的json列表像这样
[
{
"item1": null,
"item2": false,
"item3": "chr",
"item4": {
"a": [],
"b": [
{
"a": 36659026,
"b": [
3,
16
],
"c": "num"
},
{
"item1": null,
"item2": false,
"item3": "chr",
"item4": {
"a": [],
"b": [
{
"a": 36659026,
"b": [
3,
16
],
"c": "num"
},
]
我尝试过以下代码:
library(RJSONIO)
library(jsonlite)
# url with JSON content
data1 = "file.json"
data2 = readLines(data1)
#contacating all data into a single string
data2_str = paste(data2, collapse = "")
data3 = RJSONIO::fromJSON(data2_str)
我可以使用以下命令提取它3
text.1 <- c(data3[[1]]$text)
但数据集中有500个item4如何提取所有这些。