if (interactive()) {
# a list:
response <- list(code = 200L, msg = "hello, world!")
serialise(response)
#> {"code":200,"msg":"hello, world"}
serialise(response, auto_unbox = FALSE)
#> {"code":[200],"msg":["hello, world"]}
# data.frame:
serialise(cars)
}
Run the code above in your browser using DataLab