File: asJSON.AsIs.R

package info (click to toggle)
r-cran-jsonlite 1.7.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,320 kB
  • sloc: ansic: 3,792; sh: 9; makefile: 2
file content (14 lines) | stat: -rw-r--r-- 403 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
setOldClass("AsIs")
setMethod("asJSON", "AsIs", function(x, auto_unbox = FALSE, ...) {

  # Strip off the AsIs class so we can dispatch to other asJSON methods.
  class(x) <- setdiff(class(x), "AsIs")

  if (is.atomic(x) && length(x) == 1) {
    # Never auto_unbox single values when wrapped with I()
    asJSON(x, auto_unbox = FALSE, ...)

  } else {
    asJSON(x, auto_unbox = auto_unbox, ...)
  }
})