{"id":13490952,"url":"https://github.com/tmccombs/hcl2json","last_synced_at":"2025-05-14T09:06:31.060Z","repository":{"id":40693047,"uuid":"198163434","full_name":"tmccombs/hcl2json","owner":"tmccombs","description":"Convert hcl2 to json","archived":false,"fork":false,"pushed_at":"2025-03-30T03:58:44.000Z","size":185,"stargazers_count":428,"open_issues_count":7,"forks_count":53,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-05-14T09:05:08.527Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tmccombs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-07-22T06:43:31.000Z","updated_at":"2025-04-25T18:44:51.000Z","dependencies_parsed_at":"2023-02-19T04:30:57.267Z","dependency_job_id":"fef9e2a9-4b2e-4c6a-9b93-cd49c25db6e5","html_url":"https://github.com/tmccombs/hcl2json","commit_stats":{"total_commits":129,"total_committers":17,"mean_commits":7.588235294117647,"dds":0.5038759689922481,"last_synced_commit":"91c8333c891fd9ea18c5ba84cfaea98e598282f7"},"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmccombs%2Fhcl2json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmccombs%2Fhcl2json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmccombs%2Fhcl2json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmccombs%2Fhcl2json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tmccombs","download_url":"https://codeload.github.com/tmccombs/hcl2json/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254110374,"owners_count":22016391,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T19:00:52.327Z","updated_at":"2025-05-14T09:06:31.029Z","avatar_url":"https://github.com/tmccombs.png","language":"Go","funding_links":[],"categories":["Go","Tools","Recently Updated","others"],"sub_categories":["Community providers","[Feb 10, 2025](/content/2025/02/10/README.md)"],"readme":"# 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't 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't 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't 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't 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/hcl2json/):\n```shell\nsudo port install hcl2json\n```\n\n### Others\n\nPrebuilt binaries are available on the [releases page](https://github.com/tmccombs/hcl2json/releases). There is also a docker image on [dockerhub](https://hub.docker.com/r/tmccombs/hcl2json).\n\nAlternatively you can build from source (see next section).\n\n## Building\n\nYou can build and install `hcl2json` using `go get`. Since `hcl2json` uses Go modules, you will need to run this as\n`GO11MODULE=on go get github.com/tmccombs/hcl2json`.\n\nAlternatively, you can clone and build the repository:\n\n```\n$ git clone https://github.com/tmccombs/hcl2json\n$ cd hcl2json\n$ go build\n```\n\nThis will build an `hcl2json` executable in the directory.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmccombs%2Fhcl2json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftmccombs%2Fhcl2json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmccombs%2Fhcl2json/lists"}