capra
Convert between JSON, YAML and TOML.
Features
- Pretty output with syntax highlighting
- Lots of highlighting style (using chroma)
Intallation
Run go install
:
$ go install github.com/9yokuro/capra@latest
Or Download the binary from the release page
Usage
$ capra --help
Usage of capra:
-f, --format string Set the output format (default "json")
-H, --no-highlight Disable syntax highlighting
-s, --style string Set the highlight style (default "monokai")
-v, --version Print version
To output converted data to stdout:
$ capra --format=json foo.yaml bar.toml
You can use pipe:
$ echo '{ "foo": "bar" }' | capra --format=yaml
foo: bar
[!NOTE]
When you redirect to a file or use capra with another software such as jq, you MUST specify the option --no-highlight.
To write converted data to a file:
$ capra --format=json --no-highlight foo.yaml bar.toml > baz.json
With jq:
$ echo '{ "foo": [ { "bar": "baz" } ] }' | capra --format=json --no-highlight | jq -r '.foo[].bar'
baz
Available style
See Chroma Style Gallery.
License
This project is licensed under the MIT License.