R/json.R

Defines functions qread.json qwrite.json

#' @method qread json
#' @export
qread.json <- function(file, type, ...) {
	.check_package("jsonlite");

	jsonlite::unserializeJSON(paste(readLines(file), collapse="\n"), ...)
}

#' @method qwrite json
#' @export
qwrite.json <- function(x, file, type, append=FALSE, ...) {
	.check_package("jsonlite");

	cat(jsonlite::serializeJSON(x, ...), sep="", file=file, append=append)
}

Try the io package in your browser

Any scripts or data that you put into this service are public.

io documentation built on Dec. 18, 2019, 1:39 a.m.