I need to send response from R using plumber package in below format
{ \"status\": \"SUCCESS\", \"code\": \"200\", \"output\": { \"studentid\": \"1
Just remove the toJSON() wrapper. Plumber already does JSON serialisation so you are doing it twice by adding a toJSON function.
This should work.
addTwo <- function(){ x <- list(status = "SUCCESS", code = "200",output = list(studentid = "1001", name = "Kevin")) return (x) }