R/asJSON.function.R

setMethod("asJSON", "function", function(x, collapse = TRUE, fun = c("source", "list"), 
  ...) {
  # validate
  fun <- match.arg(fun)
  
  if (fun == "source") {
    return(asJSON(deparse(x), ...))
  } else {
    return(asJSON(as.list(x), ...))
  }
}) 

Try the jsonlite package in your browser

Any scripts or data that you put into this service are public.

jsonlite documentation built on July 9, 2023, 6:11 p.m.