R/asJSON.json.R

# If an object has already been encoded by toJSON(), do not encode it again
setMethod("asJSON", "json", function(x, json_verbatim = FALSE, ...) {
  if(isTRUE(json_verbatim)){
    x
  } else {
    asJSON(as.character(x), ...)
  }
})

Try the jsonlite package in your browser

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

jsonlite documentation built on June 22, 2024, 11:05 a.m.