Package 'tomleditjs'

Title: Modify TOML config files
Description: Bindings to toml-edit to work with TOML data preserving comments and whitespace.
Authors: Jeroen Ooms [aut, cre]
Maintainer: Jeroen Ooms <jeroenooms@gmail.com>
License: MIT + file LICENSE
Version: 0.1.0
Built: 2025-10-11 10:07:59 UTC
Source: https://github.com/jeroen/tomleditjs

Help Index


Parse or Edit TOML files

Description

The toml_edit() function modifies values in a TOML retaining order, comments, and whitespace.

Usage

read_toml(file, as_json = FALSE)

parse_toml(toml, as_json = FALSE)

write_toml(x, auto_unbox = TRUE)

edit_toml(toml, field, value)

Arguments

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 I(). See also jsonlite::toJSON.

field

name of field to change, for example package.version.

value

new value of field to set.

References

toml-edit-js examples

Examples

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"))