File: asJSON.AsIs.R

package info (click to toggle)
r-cran-jsonlite 1.9.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,340 kB
  • sloc: ansic: 3,792; sh: 9; makefile: 6
file content (13 lines) | stat: -rw-r--r-- 383 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
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, ...)
  }
})