# 使用 Homebrew, Nix 安装 json2hcl

查看 json2hcl 的安装路径、可执行文件、元数据以及面向 AI 代理工作流的安全说明。

## 安装

```sh
sudo av install brew:json2hcl
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install json2hcl
```

  证据: local Homebrew formula metadata

### Linux

- Nix (92%):

```sh
nix profile install nixpkgs#json2hcl
```

  证据: nixpkgs package indexes: pkgs/by-name/js/json2hcl/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1

## 软件包事实

- **软件包键:** brew:json2hcl
- **软件包管理器:** Homebrew
- **软件包管理器页面:** <https://formulae.brew.sh/formula/json2hcl>
- **版本:** 0.2.0
- **来源摘要:** Convert JSON to HCL, and vice versa
- **主页:** <https://github.com/kvz/json2hcl>
- **仓库:** <https://github.com/kvz/json2hcl>
- **许可证:** MIT
- **源码归档:** <https://github.com/kvz/json2hcl/archive/refs/tags/v0.2.0.tar.gz>
- **最后更新:** 2026-07-26T04:08:08+02:00
- **已生成:** 2026-08-04T22:13:35+00:00

## 可执行文件

- json2hcl (cli)
- json2hcl (别名)

## 构建依赖

- go

## 安装行为

- post-install 钩子: 未定义
- Bottle: 可用 于 arm64_linux, arm64_sequoia, arm64_sonoma, arm64_tahoe, arm64_ventura, sonoma, ventura, x86_64_linux

## 版本和新鲜度

- 页面生成时间: 2026-08-04
- 管理器版本: 0.2.0
- 管理器更新时间: 2026-07-26
- 本地数据: OK
- 上游仓库: https://github.com/kvz/json2hcl
- 检测到的最新版本: v0.2.0 (当前)
## 项目历史与用法

json2hcl is a small Go command-line converter for moving data between JSON and HashiCorp Configuration Language. Its niche is the Terraform-era need to translate machine-friendly JSON into a more readable HCL form without building a larger configuration system.

### 项目历史

Kevin van Zonneveld published json2hcl in September 2016 around a workflow for an internal tool named Frey. The README says the authors wanted to store infrastructure recipes as HCL after converting from machine-readable JSON, YAML, or TOML, and it explicitly notes that the tool used existing HashiCorp libraries rather than inventing a parser.

The project soon added reverse conversion with the `-reverse` flag, exposing hcl2json behavior through the same executable. By June 25, 2025, the GitHub repository was archived; its README states that the original author no longer used it, while leaving the code available for forks.

### 采用历史

Adoption appears to have been modest but durable in package-manager terms: the tool was packaged by Homebrew and Nix, and the repository accumulated hundreds of stars and forks before archival. Its presence in Homebrew reflects the small-CLI pattern where a narrow converter remains useful even after upstream development slows.

### 使用方式

The canonical usage is Unix-pipeline oriented: feed JSON on standard input and receive HCL on standard output, or pass `-reverse` to convert HCL back to JSON. The README examples focus on Terraform-like `.tf.json` input and redirection to `.tf` files.

### 为什么软件包爱好者会关心

json2hcl is interesting because it captures a short period when HCL was becoming a preferred human-edited configuration language around HashiCorp tools, while JSON remained the common interchange format. For package collectors, it is a tiny bridge utility whose package-manager value is convenience rather than ecosystem size.

### 时间线

- 2016-09-05: The GitHub repository was created.
- 2016-09-05: v0.0.4 changelog entry covered error handling and release cross-compilation.
- 2016-09-06: v0.0.5 added reverse HCL-to-JSON conversion through `-reverse`.
- 2024-09-05: GitHub listed v0.2.0 among repository releases.
- 2025-06-25: The repository was archived by its owner.

### Related projects

- json2hcl is directly tied to HashiCorp HCL and Terraform-style JSON configuration. It also sits near other one-purpose data converters such as hcl2json, JSON-to-YAML tools, and Unix filters used in infrastructure repositories.

### 来源

- <https://api.github.com/repos/kvz/json2hcl>
- <https://formulae.brew.sh/formula/json2hcl>
- <https://github.com/kvz/json2hcl>
- <https://github.com/kvz/json2hcl/releases>


## 安全说明

narrow executable package without higher-risk signals.

- **Geiger 风险:** 绿色 / 低
- narrow executable package without higher-risk signals

## 源数据库详情

- **Source Database:** Homebrew formula API
- **Tap:** homebrew/core
- **Full Name:** json2hcl
- **Version Scheme:** 0
- **Revision:** 0
- **Head Version:** HEAD
- **Bottle Stable Root URL:** <https://ghcr.io/v2/homebrew/core>
- **Deprecated:** yes
- **Disabled:** no
- **Keg Only:** no
- **URL Keys:** head, stable

## 其他软件包管理器记录

- Nix - json2hcl: normalized package name match | nixpkgs package indexes: pkgs/by-name/js/json2hcl/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1


## 相关链接

- [Source-control packages](https://pkg.so/zh-hans/source-control-tools/) - Belongs to a source-control command family.
- [Terminal utility packages](https://pkg.so/zh-hans/terminal-utilities/) - Matched terminal and command-line workflow metadata.
- [Text processing packages](https://pkg.so/zh-hans/text-processing-tools/) - Matched text, document, or structured-data processing metadata.
- [Developer build packages](https://pkg.so/zh-hans/developer-build-tools/) - Matched build, compiler, generator, or developer workflow metadata.
- [go](https://pkg.so/zh-hans/brew/go/) - Build dependency declared by Homebrew.
- [config-file-validator](https://pkg.so/zh-hans/brew/config-file-validator/) - Shares pkgdb curated category or tags: cli, configuration, developer-tools, json.
- [dhall-json](https://pkg.so/zh-hans/brew/dhall-json/) - Shares pkgdb curated category or tags: cli, configuration, developer-tools, json.
- [json2tsv](https://pkg.so/zh-hans/brew/json2tsv/) - Shares pkgdb curated category or tags: cli, converter, developer-tools, json.
- [rich-cli](https://pkg.so/zh-hans/brew/rich-cli/) - Shares pkgdb curated category or tags: cli, developer-tools, json.
- [butane](https://pkg.so/zh-hans/brew/butane/) - Shares pkgdb curated category or tags: cli, configuration, developer-tools.
- [editorconfig](https://pkg.so/zh-hans/brew/editorconfig/) - Shares pkgdb curated category or tags: cli, configuration, developer-tools.
- [jp](https://pkg.so/zh-hans/brew/jp/) - Shares pkgdb curated category or tags: cli, developer-tools, json.
- [dynaconf](https://pkg.so/zh-hans/brew/dynaconf/) - Shares pkgdb curated category or tags: cli, configuration, developer-tools.
- [dhall-toml](https://pkg.so/zh-hans/brew/dhall-toml/) - Local package facts share a topical domain. Shared terms: cli, configuration, convert, converter, developer.
- [dhall-yaml](https://pkg.so/zh-hans/brew/dhall-yaml/) - Local package facts share a topical domain. Shared terms: cli, configuration, convert, converter, developer.

## Combined YAML source

View the package source record on GitHub. [combined/json2hcl.yml](https://github.com/mxcl/pkgdb/blob/main/combined/json2hcl.yml)


## 来源

- pkg.so package database
- Geiger risk classifier
- package-page enrichment
- curated package history
- package version freshness
- pkgdb category and tag curation
- package relationship graph
- external package-manager database matches
- cross-ecosystem install command graph
