Originally created by @padhia on GitHub (Feb 7, 2024).
Hi, just came here to check Pkl out. Unless it's hidden somewhere, I didn't see TOML being supported as an output format. Would it be possible to add TOML support?
Thanks!
Originally created by @padhia on GitHub (Feb 7, 2024).
Hi, just came here to check Pkl out. Unless it's hidden somewhere, I didn't see TOML being supported as an output format. Would it be possible to add TOML support?
Thanks!
@bioball commented on GitHub (Feb 7, 2024):
Hi, at the moment, TOML support is implemented via a package, rather than in the standard library.
https://pkl-lang.org/package-docs/pkg.pkl-lang.org/pkl-pantry/pkl.toml/current/index.html
You can render TOML via:
```groovy
import "package://pkg.pkl-lang.org/pkl-pantry/pkl.toml@1.0.0#/toml.pkl"
output {
renderer = new toml.Renderer {}
}
```
Thank you for the link. Please consider adding TOML to a future version of the CLI to make generating TOML files easier.
@padhia commented on GitHub (Feb 7, 2024):
Thank you for the link. Please consider adding TOML to a future version of the CLI to make generating TOML files easier.
toml is extremely popular configuration/interchange format. Kindly do consider it adding it in the mainstream code
@zaxebo1 commented on GitHub (Feb 12, 2024):
toml is extremely popular configuration/interchange format. Kindly do consider it adding it in the mainstream code
Any updates on supporting TOML? Our team is a bit weary of downloading arbitrary code off the internet just to get toml support.
@brimworks commented on GitHub (Jul 10, 2025):
Any updates on supporting TOML? Our team is a bit weary of downloading arbitrary code off the internet just to get toml support.
pkl.toml is a package that you can include as a dependency in a project. This means that its integrity is verified whenever it is downloaded, and can also vendor inside your repo (by setting the cache dir to a local relative path).
To use toml as a dependency, your PklProject should have:
You'll then want to run pkl project resolve to create a PklProject.deps.json file in the same folder. Once you have that, you can import toml using dependency notation:
import "@toml/toml.pkl"
Or, if you don't want to use projects for some reason, you can also specify the SHA checksum as part of the import itself:
All this to say: you shouldn't need to be concerned about the TOML package as coming from the internet.
@bioball commented on GitHub (Jul 10, 2025):
`pkl.toml` is a package that you can include as a dependency in a [project](https://pkl-lang.org/main/current/language-reference/index.html#project-dependencies). This means that its integrity is verified whenever it is downloaded, and can also vendor inside your repo (by setting the cache dir to a local relative path).
To use toml as a dependency, your PklProject should have:
```pkl
amends "pkl:Project"
dependencies {
["toml"] {
uri = "package://pkg.pkl-lang.org/pkl-pantry/pkl.toml@1.0.2"
}
}
```
You'll then want to run `pkl project resolve` to create a `PklProject.deps.json` file in the same folder. Once you have that, you can import toml using dependency notation:
```pkl
import "@toml/toml.pkl"
```
Or, if you don't want to use projects for some reason, you can also specify the SHA checksum as part of the import itself:
```pkl
import "package://pkg.pkl-lang.org/pkl-pantry/pkl.toml@1.0.2::sha256:45fea4cf14e7d776e131b338efe2a7016f86c87b0c0f532409f728033bd82f71#/toml.pkl"
```
All this to say: you shouldn't need to be concerned about the TOML package as coming from the internet.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @padhia on GitHub (Feb 7, 2024).
Hi, just came here to check Pkl out. Unless it's hidden somewhere, I didn't see TOML being supported as an output format. Would it be possible to add TOML support?
Thanks!
@bioball commented on GitHub (Feb 7, 2024):
Hi, at the moment, TOML support is implemented via a package, rather than in the standard library.
https://pkl-lang.org/package-docs/pkg.pkl-lang.org/pkl-pantry/pkl.toml/current/index.html
You can render TOML via:
@padhia commented on GitHub (Feb 7, 2024):
Thank you for the link. Please consider adding TOML to a future version of the CLI to make generating TOML files easier.
@zaxebo1 commented on GitHub (Feb 12, 2024):
toml is extremely popular configuration/interchange format. Kindly do consider it adding it in the mainstream code
@bioball commented on GitHub (Feb 23, 2024):
We're working on it!
@brimworks commented on GitHub (Jul 10, 2025):
Any updates on supporting TOML? Our team is a bit weary of downloading arbitrary code off the internet just to get toml support.
@bioball commented on GitHub (Jul 10, 2025):
pkl.tomlis a package that you can include as a dependency in a project. This means that its integrity is verified whenever it is downloaded, and can also vendor inside your repo (by setting the cache dir to a local relative path).To use toml as a dependency, your PklProject should have:
You'll then want to run
pkl project resolveto create aPklProject.deps.jsonfile in the same folder. Once you have that, you can import toml using dependency notation:Or, if you don't want to use projects for some reason, you can also specify the SHA checksum as part of the import itself:
All this to say: you shouldn't need to be concerned about the TOML package as coming from the internet.