Read JSON and TOML files in as yml objects with read_*(). Write yml objects out as JSON and YAML files with write_as_*(). You can also provide write_as_*() a path to an existing .yml file to translate to JSON or TOML. These functions rely on Hugo and blogdown, so you must have blogdown installed.

read_json(path)

read_toml(path)

write_as_json(
  .yml = NULL,
  path = NULL,
  out = NULL,
  build_ignore = FALSE,
  git_ignore = FALSE,
  quiet = FALSE
)

write_as_toml(
  .yml = NULL,
  path = NULL,
  out = NULL,
  build_ignore = FALSE,
  git_ignore = FALSE,
  quiet = FALSE
)

Arguments

path

a path to a JSON or TOML file

.yml

a yml object created by yml(), as_yml(), or returned by a yml_*() function

out

The path to write out to. If NULL, will write to the path but change the file extension to .toml or .json.

build_ignore

Logical. Should the file be added to the .Rbuildignore file?

git_ignore

Logical. Should the file be added to the .gitignore file?

quiet

Logical. Whether to message about what is happening.

Value

a yml object (if reading) or the path (if writing)

See also