diff --git a/NEWS.md b/NEWS.md index 880fdc2..792959f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,7 @@ # czso (development version) * fix documentation to avoid CRAN NOTEs +* handle invalid JSON in old CZSO API * hard-deprecate old functions; they will be removed in the next version # czso 0.3.10 diff --git a/R/core.R b/R/core.R index 817b90b..4fe6d88 100644 --- a/R/core.R +++ b/R/core.R @@ -115,7 +115,8 @@ czso_get_dataset_metadata <- function(dataset_id) { httr::user_agent(ua_string)) %>% httr::stop_for_status() %>% httr::content(as = "text") - mtdt <- jsonlite::fromJSON(mtdt_c)[["result"]] + mtdt_c_sanitised <- gsub("\\t", "\\s", mtdt_c) + mtdt <- jsonlite::fromJSON(mtdt_c_sanitised)[["result"]] if(is.null(mtdt)) cli::cli_abort("No dataset found with this ID.") return(mtdt) }