Use
gsub()
jsontest <- gsub(pattern = '^\[', replacement = "", x = jsontest)
jsontest <- gsub(pattern = '\]$', replacement = "", x = jsontest)
Resultados :
{
"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"
}
]
}
Ainda
json
classe :> class(jsontest)
[1] "json"
Mas talvez o espaço em branco possa causar alguns problemas.