is.json.file: Function to check wheather file is JSON format

Description Usage Arguments Value See Also Examples

View source: R/configtype.R

Description

Function to check wheather file is JSON format

Usage

1
2
3
4
5
is.json.file(
  file = Sys.getenv("R_CONFIGFILE_ACTIVE", "config.cfg"),
  json.file.debug = FALSE,
  ...
)

Arguments

file

File name of configuration file to test. Defaults to the value of the 'R_CONFIGFILE_ACTIVE' environment variable ('config.cfg' if the variable does not exist and JSON/INI/YAML/TOML format only)

json.file.debug

If TRUE, it will show error infomation when read JSON config, default is FALSE

...

Arguments for readLines and fromJSON

Value

Logical indicating whether the specified configuration file is JSON format

See Also

is.ini.file, is.yaml.file, is.toml.file

Examples

1
2
3
4
5
6
7
8
config.json <- system.file('extdata', 'config.json', package='configr')
config.ini <- system.file('extdata', 'config.ini', package='configr')
config.yaml <- system.file('extdata', 'config.yaml', package='configr')
config.toml <- system.file('extdata', 'config.toml', package='configr')
print(is.json.file(config.json))
print(is.json.file(config.ini))
print(is.json.file(config.yaml))
print(is.json.file(config.toml))

configr documentation built on July 17, 2020, 5:07 p.m.