Learn
Evaluation and Output
Evaluate Pkl modules and choose output formats with the Pkl CLI.
Evaluation and Output
Pkl evaluation turns a module into a structured value. For language learning,
use the official pkl CLI as the baseline.
Evaluate a Module
pkl eval config.pklWhen no format is set, the default renderer chooses PCF. This is useful while learning because the output keeps Pkl's object/listing/mapping shape visible.
name = "api"port = 8080tags = new Listing { "pkl" "configuration"}Evaluate an Expression
Use -x when you only need one value from a module:
pkl eval -x name config.pklpkl eval -x port config.pklRender for a Consumer
Use -f to choose an output format:
pkl eval -f json config.pklpkl eval -f yaml config.pklUse -o when the output should be written to a file:
pkl eval -f json -o config.json config.pklValidation
pkl eval config.pklEvaluation must parse the module, resolve imports, enforce type annotations, and run constraints before output is produced. If a constraint fails, fix the source instead of treating rendering as a separate step.
Output Formats
Pkl's CLI supports multiple renderers through -f. This documentation treats
PCF, JSON, YAML, properties, plist, and related formats as language-facing output
contracts.
| Format | CLI Usage |
|---|---|
| PCF | pkl eval config.pkl |
| JSON | pkl eval -f json config.pkl |
| YAML | pkl eval -f yaml config.pkl |
| properties | pkl eval -f properties config.pkl |
| plist | pkl eval -f plist config.pkl |
Diagnostics
Diagnostics surface from the stage that failed: syntax, import resolution, typing, constraints, evaluation, or rendering. Keep the smallest failing module nearby, then compare the behavior with Coverage Status when the local toolchain differs from the official CLI.