I have the following JSON object:
{"42030636":{"String1":"dixit dominus","String2":"la resurrezione","String3":"water music"}}
After I ingested it using fromJSON() (Jsonlite). I got the following nested list (let's call it list):
$`42030636`$String1
[1] "dixit dominus"
$String2
[1] "la resurrezione"
$String3
[1] "water music"
I'm trying to create a data frame which will look like this:
item_id String1 String2 String3
42030636 dixit dominus la resurrezione water music
I know that I was able to get the elements in String1:3 using this in a for-loop:
for (i in 1:4) {print(list[1][[1]][1:4]}
The problem is that I can't get the numeric between ` `. It seems that it is at the top level of the JSON block but it can't be "sliced".
When I tried tidyjson package, I couldn't even import the file and it gave me an empty 1x1 tibble. I'm thinking the structure of the original JSON file is off.