Linux command
jsonnet 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Evaluate Jsonnet file
jsonnet [file.jsonnet]
Output to file
jsonnet [file.jsonnet] -o [output.json]
Evaluate with external variable
jsonnet --ext-str [name=value] [file.jsonnet]
Multi-file output
jsonnet -m [output_dir] [file.jsonnet]
Evaluate expression
jsonnet -e "[{a: 1, b: 2}]"
Format Jsonnet file
jsonnetfmt [file.jsonnet]
说明
Jsonnet is a data templating language that generates JSON. It adds variables, conditionals, functions, and imports to JSON, making configuration files more maintainable. Jsonnet is used for generating Kubernetes manifests, Prometheus configurations, and other JSON/YAML configs. It evaluates to pure JSON.
参数
- -o _file_
- Output file.
- -m _dir_
- Multi-file output directory.
- -e _code_
- Evaluate expression.
- --ext-str _name=value_
- External string variable.
- --ext-code _name=code_
- External code variable.
- -J _dir_
- Add library search path.
- -S, --string
- Output as string.
- --tla-str _name=value_
- Top-level argument string.
FAQ
What is the jsonnet command used for?
Jsonnet is a data templating language that generates JSON. It adds variables, conditionals, functions, and imports to JSON, making configuration files more maintainable. Jsonnet is used for generating Kubernetes manifests, Prometheus configurations, and other JSON/YAML configs. It evaluates to pure JSON.
How do I run a basic jsonnet example?
Run `jsonnet [file.jsonnet]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -o _file_ do in jsonnet?
Output file.