Can I use either <ktoml> or <tomlkt> like <TomlJ> ...
# serialization
a
Can I use either ktoml or tomlkt like TomlJ and extract strings without needing to create my own classes? I just want to quickly extract some strings from a TOML file.
Copy code
import org.tomlj.Toml

val libs = Toml.parse(File("data.toml").toPath())
val externalVersion = libs.getString("content.version")
a
Why not use TomlJ then?
a
I prefer using Kotlin libraries, they usually have a nicer usage and I can avoid platform types.
l
tomlkt:
Copy code
val externalVersion = Toml.decodeFromNativeReader<String>(
    Path("data.toml").reader(),
    "content", "version"
)