rstudio / config

config package for R
https://rstudio.github.io/config/
256 stars 27 forks source link

Can no longer convert config to json string #49

Closed mmoisse closed 1 year ago

mmoisse commented 1 year ago

I used to read config files and transform them into json strings using jsonlite::toJSON But since the latest release 0.3.2 this is no longer possible while in 0.3.1 this still works

A minimal example

write("default:\n  - test: a", "/tmp/config.yaml")
config <- config::get(file = "/tmp/config.yaml")
jsonlite::toJSON(config)

In version 0.3.1 I get this as result

[{"test":["a"]}] 

but in 0.3.2 I get this error message

Error: No method asJSON S3 class: config
andrie commented 1 year ago

Thank you.

This is a use case that isn't in the test configuration, but clearly makes a lot of sense. I'm sorry the class oversight in v0.3.2 broke this for you.

I've fixed this in the main branch.

mmoisse commented 1 year ago

This solved the issue, Tx