Tools to Work with the 'Splash' JavaScript Rendering Service in R
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
471B

  1. #' Convert a Base64 encoded string into an R object
  2. #'
  3. #' A simple wrapper around calls to `openssl::base64_decode()` and
  4. #' `jsonlite::fromJSON()`.
  5. #'
  6. #' @md
  7. #' @param x a string
  8. #' @param flatten flatten JSON structures upon conversion?
  9. #' @param ... passed on to `jsonlite::fromJSON()`
  10. #' @export
  11. json_fromb64 <- function(x, flatten=TRUE, ...) {
  12. tmp <- openssl::base64_decode(x)
  13. tmp <- readBin(tmp, "character")
  14. jsonlite::fromJSON(tmp, flatten=flatten, ...)
  15. }