diraol / hclq

HCL to JSON with jq passthrough

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hclq - HCL + JQ

Read HCL from stdin and pass to jq.

Build

make

Usage

Usage: hclq [jq options] < file.hcl

hclq - Convert HCL into JSON

# Example: Basic HCL to JSON conversion (no jq)
$ echo 'x { y = "z" }' | hclq
{"x":{"y":"z"}}

# Example: Pass JSON to jq
$ echo 'x { y = "z" }' | hclq '.'
{
  "x": {
    "y": "z"
  }
}

# Example: Pass query to jq
$ echo 'x { y = "z" }' | ./hclq '.x.y'
"z"

# Example: Pass query and options to jq
$ echo 'x { y = "z" }' | ./hclq -r '.x.y'
z

References

About

HCL to JSON with jq passthrough


Languages

Language:Go 95.7%Language:Makefile 3.0%Language:Shell 1.4%