hcl2json
brew install hcl2json
v0.6.9
Apache-2.0
Convert HCL2 to JSON
99
30-day installs · #3488
831
90-day · #2378
3.9k
365-day · #2162
478
★ GitHub stars · updated 4mo ago
Build dependencies
Links
- https://github.com/tmccombs/hcl2json
- GitHub: tmccombs/hcl2json
- Brew formula source: Formula/h/hcl2json.rb
Raw metadata
{
"aliases": [],
"alternatives": [],
"build_dependencies": [
"go"
],
"categories": [],
"caveats": null,
"conflicts_with": [],
"dependencies": [],
"deprecated": 0,
"deprecation_reason": null,
"desc": "Convert HCL2 to JSON",
"disable_reason": null,
"disabled": 0,
"enrichment_fetched_at": "2026-06-20T23:38:34+00:00",
"first_seen": "2026-06-20T23:34:18+00:00",
"full_name": "hcl2json",
"github_default_branch": "main",
"github_last_commit_at": "2026-04-20T07:47:45Z",
"github_readme_excerpt": "# hcl2json\n\nThis is a tool to convert from [HCL](https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md) to json, to make it\neasier for non-go applications and scripts to process HCL inputs (such as terraform config).\n\nIf passed the `-pack` option, it converts to the JSON pack format used by\n[hclpack](https://godoc.org/github.com/hashicorp/hcl2/hclpack), which contains the original structure of the document. However,\nall it has for expressions is the source text, which isn\u0027t always very useful.\n\nIf no options are passed, it converts the native HCL file to an (almost) equivalent HCL JSON file. Note, however, that there are\nsome corner cases where it may not be exactly equivalent, especially if the target application makes use of [static\nanalysis](https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md#static-analysis).\n\n## Alternatives\n\nAt the time this project created, there weren\u0027t really any other object. However, the HCL project itself now includes an\n[`hcldec`](https://github.com/hashicorp/hcl/tree/main/cmd/hcldec) command that can convert hcl to json if you give it a\nspecification. One advantage of hcl2json is it doesn\u0027t require a specification, so for use cases where the heuristics are correct\nit may be easier to use. However, if you have cases hit the limitations of conversion listed above, `hcldec` is probably a\nbetter fit.\n\n## Usage\n\n```sh\n# convert a file from hcl to json\n$ hcl2json some-file.hcl \u003e out.json\n# reading from stdin also works\n$ hcl2json \u003c infile.hcl \u003e out.json\n# simplify any expressions that don\u0027t use variables or unknown functions\n$ hcl2json -simplify infile.hcl \u003e out.json\n```\n\nIf you use the docker image, you can invoke with\n\n```sh\n$ docker run -it --rm -v $PWD:/tmp tmccombs/hcl2json /tmp/infile.hcl\n```\n\n## Installation\n\n### Mac OS\n\nInstall with [Homebrew](https://formulae.brew.sh/formula/hcl2json):\n```shell\nbrew install hcl2json\n```\n\n`hcl2json` can also be installed via [MacPorts](https://ports.macports.org/port/hc",
"github_repo": "tmccombs/hcl2json",
"github_stars": 478,
"github_topics": [],
"homepage": "https://github.com/tmccombs/hcl2json",
"homepage_og_description": null,
"homepage_og_image": null,
"homepage_title": null,
"installs_30d": 99,
"installs_365d": 3899,
"installs_90d": 831,
"keg_only": 0,
"keg_only_reason": null,
"last_seen": "2026-06-20T23:34:18+00:00",
"license": "Apache-2.0",
"llm_generated_at": null,
"llm_model": null,
"name": "hcl2json",
"oldnames": [],
"one_liner": null,
"optional_dependencies": [],
"rank_30d": 3488,
"rank_365d": 2162,
"rank_90d": 2378,
"raw_hash": "d0ed1fd1fd04637f",
"recommended_dependencies": [],
"revision": 0,
"ruby_source_path": "Formula/h/hcl2json.rb",
"tap": "homebrew/core",
"test_dependencies": [],
"uses_from_macos": [],
"version_head": "HEAD",
"version_stable": "0.6.9",
"versioned_formulae": [],
"why_use_this": null
}