{"id":13451717,"url":"https://github.com/kvz/json2hcl","last_synced_at":"2025-05-15T07:03:37.845Z","repository":{"id":10908933,"uuid":"67414319","full_name":"kvz/json2hcl","owner":"kvz","description":"Convert JSON to HCL, and vice versa. We don't use json2hcl anymore ourselves, so we can't invest time into it. However, we're still welcoming PRs.","archived":false,"fork":false,"pushed_at":"2025-02-12T08:57:39.000Z","size":40,"stargazers_count":515,"open_issues_count":11,"forks_count":103,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-04-11T15:57:14.432Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://github.com/kvz/json2hcl","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kvz.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2016-09-05T11:13:59.000Z","updated_at":"2025-04-10T07:27:28.000Z","dependencies_parsed_at":"2025-03-27T14:47:01.803Z","dependency_job_id":"6e0ed896-4fc2-455f-90dd-f123257421fd","html_url":"https://github.com/kvz/json2hcl","commit_stats":{"total_commits":43,"total_committers":9,"mean_commits":4.777777777777778,"dds":0.6046511627906976,"last_synced_commit":"089e085d6bd8602aa8bedfe50fea6647fd28bbea"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kvz%2Fjson2hcl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kvz%2Fjson2hcl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kvz%2Fjson2hcl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kvz%2Fjson2hcl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kvz","download_url":"https://codeload.github.com/kvz/json2hcl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254291961,"owners_count":22046424,"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-31T07:01:00.266Z","updated_at":"2025-05-15T07:03:37.717Z","avatar_url":"https://github.com/kvz.png","language":"HCL","funding_links":[],"categories":["Tools","HCL"],"sub_categories":["Miscellaneous","Community providers"],"readme":"[![Build Status](https://travis-ci.org/kvz/json2hcl.svg?branch=master)](https://travis-ci.org/kvz/json2hcl)\n\n# json2hcl (and hcl2json)\n\nConvert JSON to HCL and HCL to JSON via STDIN / STDOUT.\n\n## Warning\n\nWe don't use json2hcl anymore ourselves, so we can't invest time into it. However, we're still welcoming PRs.\n\n## Install\n\nCheck the [releases](https://github.com/kvz/json2hcl/releases) for the latest version.\nThen it's just a matter of downloading the right one for you platform, and making the binary\nexecutable. \n\n### Linux\n\nHere's how it could look for 64 bits Linux, if you wanted `json2hcl` available globally inside\n`/usr/local/bin`:\n\n```bash\ncurl -SsL https://github.com/kvz/json2hcl/releases/download/v0.0.6/json2hcl_v0.0.6_linux_amd64 \\\n  | sudo tee /usr/local/bin/json2hcl \u003e /dev/null \u0026\u0026 sudo chmod 755 /usr/local/bin/json2hcl \u0026\u0026 json2hcl -version\n```\n\n### OSX\n\nHere's how it could look for 64 bits Darwin, if you wanted `json2hcl` available globally inside\n`/usr/local/bin`:\n\n```bash\ncurl -SsL https://github.com/kvz/json2hcl/releases/download/v0.0.6/json2hcl_v0.0.6_darwin_amd64 \\\n  | sudo tee /usr/local/bin/json2hcl \u003e /dev/null \u0026\u0026 sudo chmod 755 /usr/local/bin/json2hcl \u0026\u0026 json2hcl -version\n```\n\n## Use\n\nHere's an example [`fixtures/infra.tf.json`](fixtures/infra.tf.json) being\nconverted to HCL:\n\n```bash\n$ json2hcl \u003c fixtures/infra.tf.json\n\"output\" \"arn\" {\n  \"value\" = \"${aws_dynamodb_table.basic-dynamodb-table.arn}\"\n}\n... rest of HCL truncated\n```\n\nTypical use would be\n\n```bash\n$ json2hcl \u003c fixtures/infra.tf.json \u003e fixtures/infra.tf\n```\n\n## hcl2json\n\nAs a bonus, the conversion the other way around is also supported via the `-reverse` flag:\n\n```bash\n$ json2hcl -reverse \u003c fixtures/infra.tf\n{\n  \"output\": [\n    {\n      \"arn\": [\n        {\n          \"value\": \"${aws_dynamodb_table.basic-dynamodb-table.arn}\"\n        }\n      ]\n    }, \n  ... rest of JSON truncated\n  ]\n}\n```\n\n## Development\n\n```bash\nmkdir -p ~/go/src/github.com/kvz\ncd ~/go/src/github.com/kvz\ngit clone git@github.com:kvz/json2hcl.git\ncd json2hcl\ngo get\n```\n\n## Why?\n\nIf you don't know HCL, read [Why HCL](https://github.com/hashicorp/hcl#why).\n\nAs for why json2hcl and hcl2json, we're building a tool called Frey that marries multiple underlying\ntools. We'd like configuration previously written in YAML or TOML to now be in HCL now as well. \nIt's easy enough to convert the mentioned formats to JSON, and strictly speaking HCL is already \nable to read JSON natively, so why the extra step?\n\nWe're doing this for readability and maintainability, we wanted to save \nour infra recipes as HCL directly in our repos, instead of only having machine readable intermediate \nJSON that we'd need to hack on. This saves time spotting problems, and makes the experience somewhat \nenjoyable even.\n\nIn the off-chance you too have machine-readable JSON and are interested in converting that\nto the more human-being friendly HCL format, we thought we'd share this.\n\nIt's no rocket science, we're using already available HashiCorp libraries to support the conversion,\nHashiCorp could have easily released their own tools around this, and perhaps they will, but \nso far, they haven't.\n\n## Changelog\n\n### Ideabox (Unplanned)\n\n- [ ] Give the README.md some love\n\n### v0.0.7 (Unreleased)\n\n- [ ] Tests\n\n### v0.0.6 (2016-09-06)\n\n- [x] Deprecate goxc in favor of native builds\n\n### v0.0.5 (2016-09-06)\n\n- [x] Add hcl2json via the `-reverse` flag \n\n### v0.0.4 (2016-09-05)\n\n- [x] Error handling\n- [x] Cross-compiling and shipping releases\n\n## Contributors\n\n- [Marius Kleidl](https://github.com/Acconut)\n- [Kevin van Zonneveld](https://github.com/kvz)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkvz%2Fjson2hcl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkvz%2Fjson2hcl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkvz%2Fjson2hcl/lists"}