| Title: | Read, Write, and Modify TOML Files |
|---|---|
| Description: | Simple toolkit for working with TOML text. Based on tomledit which allows for modifying TOML while preserving order, comments,and whitespace. |
| Authors: | Jeroen Ooms [aut, cre] |
| Maintainer: | Jeroen Ooms <jeroenooms@gmail.com> |
| License: | MIT + file LICENSE |
| Version: | 1.0.0 |
| Built: | 2026-01-02 10:26:29 UTC |
| Source: | https://github.com/jeroen/toml |
The edit_toml() function modifies values in a TOML text while retaining the
order, comments, and whitespace. Use read_toml() and write_toml() to convert
between TOML text and R lists.
read_toml(file, as_json = FALSE) parse_toml(toml, as_json = FALSE) write_toml(x, auto_unbox = TRUE) edit_toml(toml, field, value)read_toml(file, as_json = FALSE) parse_toml(toml, as_json = FALSE) write_toml(x, auto_unbox = TRUE) edit_toml(toml, field, value)
file |
path to file with toml text |
as_json |
return output as json string instead of R list |
toml |
string |
x |
vector or json string to convert to TOML |
auto_unbox |
convert atomic vectors of length 1 as scalars in TOML, unless
they are wrapped in |
field |
name of field to change, for example |
value |
new value of field to set. |
parse_toml() returns a list and edit_toml() returns the modified
TOML text.
toml <- readLines('https://raw.githubusercontent.com/posit-dev/air/refs/heads/main/Cargo.toml') toml <- edit_toml(toml, 'workspace.package.rust-version', '1.84') toml <- edit_toml(toml, 'workspace.dependencies.bla', list(path = "./yolo", rev = "123"))toml <- readLines('https://raw.githubusercontent.com/posit-dev/air/refs/heads/main/Cargo.toml') toml <- edit_toml(toml, 'workspace.package.rust-version', '1.84') toml <- edit_toml(toml, 'workspace.dependencies.bla', list(path = "./yolo", rev = "123"))