Gebruik gsub()
jsontest <- gsub(pattern = '^\[', replacement = "", x = jsontest)
jsontest <- gsub(pattern = '\]$', replacement = "", x = jsontest)
Resultaten :
{
"section_id": {},
"name": "name1",
"slug": "slug1"
},
{
"section_id": {},
"name": "name2",
"slug": "slug2"
},
{
"section_id": {},
"name": "name3",
"slug": "slug3",
"categories": [
{
"section_id": {},
"name": "name31",
"slug": "slug31"
},
{
"section_id": {},
"name": "name32",
"slug": "slug32"
}
]
}
Still json
klas :
> class(jsontest)
[1] "json"
Maar misschien kan de lege ruimte voor problemen zorgen.