File: asJSON.json.R

package info (click to toggle)
r-cran-jsonlite 1.6%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,304 kB
  • sloc: ansic: 3,789; sh: 9; makefile: 2
file content (9 lines) | stat: -rw-r--r-- 252 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
# If an object has already been encoded by toJSON(), do not encode it again
setOldClass("json")
setMethod("asJSON", "json", function(x, json_verbatim = FALSE, ...) {
  if(isTRUE(json_verbatim)){
    x
  } else {
    asJSON(as.character(x), ...)
  }
})