我正在尝试通过在httr::POST
中传递字符串数字数组来提取json主体。它必须为array
。例如,
body = toJSON(x=list('_id'="1"), auto_unbox=TRUE)
无效。
如何在正文中传递像上面一样的字符串数字数组?
res <-httr::POST(url=some url,
httr::add_headers(
"Accept"= "application/json",
"Authorization" = my Token,
"Content-Type"= "application/json"),
body = ????, #how do i pass ["1"]
endoce = ???)
content(res,as = 'text')