Validate JSON in file or string

validate_json_file(filename, verbose = FALSE, opts = list(), ...)

validate_json_str(str, verbose = FALSE, opts = list(), ...)

Arguments

filename

path to file containing JSON

verbose

logical. If the JSON is not valid, should a warning be shown giving details?

opts

Named list of options for parsing. Usually created by opts_read_json()

...

Other named options can be used to override any options in opts. The valid named options are identical to arguments to opts_read_json()

str

character string containing JSON

Value

Logical value. TRUE if JSON validates as OK, otherwise FALSE

Examples

tmp <- tempfile()
write_json_file(head(iris, 3), tmp)
validate_json_file(tmp)
#> [1] TRUE
str <- write_json_str(iris)
validate_json_str(str)
#> [1] TRUE