src/library/jsonlite/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 pak package in your browser

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

pak documentation built on June 8, 2025, 11:42 a.m.