diff --git a/R/fromJSON.R b/R/fromJSON.R index 768bed92..6185be8f 100644 --- a/R/fromJSON.R +++ b/R/fromJSON.R @@ -77,6 +77,8 @@ fromJSON <- function(txt, simplifyVector = TRUE, simplifyDataFrame = simplifyVector, simplifyMatrix = simplifyVector, flatten = FALSE, ...) { + # empty JSON -> empty data.frame + if (is.na(txt) || is.null(txt)) return(data.frame(NULL)) # check type if (!is.character(txt) && !inherits(txt, "connection")) { stop("Argument 'txt' must be a JSON string, URL or file.")