I am trying to load a POST Realtime API but unable to unlist it beacuse of Array. Can someone help me unlist. I am pretty new to R currently.
Using Below Code but getting error in Array:
request_body <- data.frame(
-
DivisionId = c(10),
-
PrimoId = c(73413),
-
Ename = c("IRK_DRILLING"),
-
Sname = c("RATE_OF_PENETRATION"),
-
StartDepth = c(0),
-
EndDepth = c(3000),
-
SidetrackNum = c(-1)
- )
request_body_json <- toJSON(request_body, auto_unbox = TRUE)
url <- "http://gngapi.********.com/RealtimeService/api/RT/GetBulkDepthData"
result <- POST(url,
-
body = request_body_json,
-
add_headers(.headers = c("Content-Type"="application/json")))
resultRaw <- content(result, as="text")
dt <- fromJSON(resultRaw)
jtxt <- unlist(dt,recursive=TRUE,use.name=TRUE)
dt2 <- fromJSON(jtxt)
Error: parse error: trailing garbage
10 73413 0113 IRK_DRILLING RATE_OF_PEN
(right here) ------^