read_json: Read and write to JSON and TOML

View source: R/convert_metadata.R

read_jsonR Documentation

Read and write to JSON and TOML

Description

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.

Usage

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

Other yml: asis_yaml_output(), bib2yml(), draw_yml_tree(), has_field(), use_yml_defaults(), use_yml_file(), use_yml(), yml_author(), yml_blogdown_opts(), yml_bookdown_opts(), yml_citations(), yml_clean(), yml_distill_opts(), yml_latex_opts(), yml_output(), yml_pagedown_opts(), yml_params(), yml_pkgdown(), yml_reference(), yml_replace(), yml_resource_files(), yml_rsconnect_email(), yml_rticles_opts(), yml_runtime(), yml_site_opts(), yml_toc(), yml_vignette()


ymlthis documentation built on Aug. 5, 2022, 5:23 p.m.