jstpl
is an utility to quickly format a json input to the user desired format using golang text/template
package.
Using a file as input and output
input.json
{
"name": "toto"
}
output.tpl
Hello {{.name}}!
bash
$ jstpl -in input.json -f output.tpl
Hello toto!
Using standard input and command line format
bash
$ echo '{"name":"toto"}' | jstpl 'Hello {{.name}}!"
Hello toto!
jstpl
makes use of plugins introduced in go 1.8. They must be located on the same directory as jstpl
, and be prefixed by jstpl-plugin-
to be loaded.
See https://github.com/Inozuma/jstpl-plugin-strings for an example.