colearendt / tidyjson

Tidy your JSON data in R with tidyjson
Other
182 stars 14 forks source link

Add validate back to as.tbl_json #98

Open colearendt opened 7 years ago

colearendt commented 7 years ago

In particular, this was referenced at sailthru/tidyjson#19. Should this be added back in?

The context there is as.tbl_json.character:

as.tbl_json.character <- function(x, ...) {

  # Check for valid
  is_valid <- vapply(x, validate, logical(1))

  if (any(!is_valid))
    stop(sprintf("%s records have invalid json data", sum(!is_valid)))

   # Parse the json
   json <- lapply(x, fromJSON, simplifyVector = FALSE)
...