File: asJSON.scalar.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 (11 lines) | stat: -rw-r--r-- 285 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
setMethod("asJSON", "scalar", function(x, collapse, ...) {
  # TODO: There must be a way to do this with NextMethod()
  if (length(class(x)) > 1) {
    class(x) <- class(x)[-1]
  } else {
    x <- unclass(x)
  }

  # Print JSON without []
  return(asJSON(x, collapse = FALSE, ...))
})