0

i'm having struggle to make a JSON from several different JSON in R. I'm making a request to an API while increasing the final parameter in function of the var "individus". For each request i receive a JSON and i only keep the "$top" part of it.

for (i in 1:individus){
    url_req <- paste("api_url", i, sep="")
    list_json1 <- fromJSON(url_req)

    if (missing(list_json1) == TRUE){
        inter_json <- list_json1$top
    }else{
        inter_json <- inter_json+list_json1$top
    }
}

My question is how can i fuse those data in a single json a little bit like that :

inter_json <- inter_json+list_json1$top
Antoine553
  • 126
  • 1
  • 1
  • 10

1 Answers1

1

I think you might be confusing the concat-operators: + is used in javscript but not in R. Since the object returned by fromJSON is a list, you need to combine lists and could have a look here: how-to-combine-two-lists-in-r

Thomas L.
  • 524
  • 1
  • 5
  • 17