{"id":47803984,"url":"https://github.com/o3co/hocon2","last_synced_at":"2026-04-03T17:23:15.126Z","repository":{"id":345666883,"uuid":"1186839659","full_name":"o3co/hocon2","owner":"o3co","description":"CLI tools to convert HOCON to JSON, YAML, TOML, and Java Properties","archived":false,"fork":false,"pushed_at":"2026-04-02T16:56:05.000Z","size":104,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":0,"default_branch":"develop","last_synced_at":"2026-04-03T04:43:43.391Z","etag":null,"topics":["cli","config","converter","go","golang","hocon","json","properties","toml","yaml"],"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/o3co.png","metadata":{"files":{"readme":"README.ja.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-20T03:29:12.000Z","updated_at":"2026-04-02T16:34:10.000Z","dependencies_parsed_at":"2026-03-20T21:03:49.165Z","dependency_job_id":null,"html_url":"https://github.com/o3co/hocon2","commit_stats":null,"previous_names":["o3co/hocon2"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/o3co/hocon2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/o3co%2Fhocon2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/o3co%2Fhocon2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/o3co%2Fhocon2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/o3co%2Fhocon2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/o3co","download_url":"https://codeload.github.com/o3co/hocon2/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/o3co%2Fhocon2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31365752,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-03T17:13:05.644Z","status":"ssl_error","status_checked_at":"2026-04-03T17:13:04.413Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["cli","config","converter","go","golang","hocon","json","properties","toml","yaml"],"created_at":"2026-04-03T17:23:14.360Z","updated_at":"2026-04-03T17:23:15.098Z","avatar_url":"https://github.com/o3co.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hocon2 — Go 向け HOCON 変換 CLI\n\n[![CI](https://github.com/o3co/hocon2/actions/workflows/ci.yml/badge.svg)](https://github.com/o3co/hocon2/actions/workflows/ci.yml)\n[![Go Reference](https://pkg.go.dev/badge/github.com/o3co/hocon2.svg)](https://pkg.go.dev/github.com/o3co/hocon2)\n[![Release](https://img.shields.io/github/v/release/o3co/hocon2)](https://github.com/o3co/hocon2/releases/latest)\n[![License](https://img.shields.io/github/license/o3co/hocon2)](LICENSE)\n\nGo 向け HOCON 変換ツール — [HOCON](https://github.com/lightbend/config/blob/main/HOCON.md) 設定ファイルを JSON、YAML、TOML、Java Properties に変換します。\n\nHOCON (Human-Optimized Config Object Notation) は、人間にとって読みやすい JSON のスーパーセットです。コメント、変数参照（`${var}`）、インクルード、クォートやカンマの省略などをサポートしています。`hocon2` を使えば、HOCON をネイティブに扱えないツール向けに、広くサポートされたフォーマットへ変換できます。\n\nパーサーには [go.hocon](https://github.com/o3co/go.hocon) を使用。[Lightbend のリファレンステストスイート](https://github.com/lightbend/config)で準拠性を検証済みです。\n\n\u003e **[Claude Code](https://claude.ai/claude-code)** (Anthropic) により設計・実装されました。\n\u003e [GitHub Copilot](https://github.com/features/copilot) および [OpenAI Codex](https://openai.com/index/openai-codex/) によるレビュー。\n\n[English](README.md)\n\n---\n\n## クイックスタート\n\n### 1. インストール\n\n#### Go\n\n```bash\ngo install github.com/o3co/hocon2/cmd/hocon2json@latest\ngo install github.com/o3co/hocon2/cmd/hocon2yaml@latest\ngo install github.com/o3co/hocon2/cmd/hocon2toml@latest\ngo install github.com/o3co/hocon2/cmd/hocon2properties@latest\n```\n\n#### バイナリリリース\n\n[リリースページ](https://github.com/o3co/hocon2/releases/latest)からビルド済みバイナリをダウンロードできます（Linux/macOS/Windows、amd64/arm64）。\n\n### 2. 使い方\n\n```bash\n# ファイルを変換\nhocon2json app.conf\n\n# 標準入力から読み込み\ncat app.conf | hocon2yaml\n\n# ヘルプを表示\nhocon2json --help\n```\n\n## なぜ hocon2？\n\nHOCON は設定の記述に最適ですが、多くのツールは JSON、YAML、TOML しか理解しません。`hocon2` がそのギャップを埋めます：\n\n- **記述** は HOCON で（可読性が高く、組み合わせ可能で DRY）\n- **デプロイ** はツールが必要とするフォーマットで（Kubernetes は JSON、Helm は YAML、Rust ツールは TOML、Java は Properties）\n- **検証** はデプロイ前に CI で構文チェック（`-validate` フラグ）\n\n## 対応フォーマット\n\n| コマンド | 出力フォーマット |\n|---|---|\n| `hocon2json` | JSON |\n| `hocon2yaml` | YAML |\n| `hocon2toml` | TOML |\n| `hocon2properties` | Java Properties |\n\n## 使い方\n\n### オプション\n\n```bash\n# コンパクト JSON 出力（空白なし）\nhocon2json -compact app.conf\n\n# インデント幅を指定（デフォルト: 2）\nhocon2json -indent 4 app.conf\n\n# ファイルに出力\nhocon2json -o output.json app.conf\n\n# 既存ファイルを上書き\nhocon2json -o output.json -overwrite app.conf\n```\n\n`-compact` と `-indent` は `hocon2json` のみで使用可能。`-o` と `-overwrite` は全コマンド共通です。\n\n### 複数ファイルのマージ\n\n引数に複数ファイルを指定できます。**右優先**でマージされます — 後に指定したファイルのキーが優先されます：\n\n```bash\nhocon2toml base.conf env.conf local.conf\n```\n\nこれは `local.conf` が `env.conf` を、`env.conf` が `base.conf` を上書きする動作です。レイヤード構成（ベース → 環境別 → ローカル上書き）に便利です。\n\n### 環境変数\n\nHOCON の変数参照（`${VAR}`）は環境変数を解決します：\n\n```bash\n# 環境変数をインラインで渡す\nDB_HOST=prod-db.example.com hocon2json app.conf\n\n# または export する\nexport DB_HOST=prod-db.example.com\nhocon2json app.conf\n```\n\n`app.conf`:\n\n```hocon\ndatabase {\n  host = ${DB_HOST}\n  host = ${?DB_HOST}  # オプショナル: DB_HOST が設定されている場合のみ使用\n}\n```\n\n### 変換例\n\n`app.conf`:\n\n```hocon\ndatabase {\n  host = \"localhost\"\n  port = 5432\n  pool_size = 10\n}\n\n// 変数参照\napi_url = \"https://\"${database.host}\":8080\"\n```\n\n```bash\n$ hocon2json app.conf\n{\n  \"api_url\": \"https://localhost:8080\",\n  \"database\": {\n    \"host\": \"localhost\",\n    \"pool_size\": 10,\n    \"port\": 5432\n  }\n}\n```\n\n## ビルド\n\n```bash\nmake all      # vet + test + build\nmake build    # ビルドのみ\nmake test     # テストのみ\nmake install  # 全バイナリをインストール\n```\n\n## 関連プロジェクト\n\n| プロジェクト | 言語 | レジストリ | 説明 |\n|---------|----------|----------|-------------|\n| [go.hocon](https://github.com/o3co/go.hocon) | Go | [pkg.go.dev](https://pkg.go.dev/github.com/o3co/go.hocon) | Go 向け HOCON パーサー（本プロジェクトで使用） |\n| [ts.hocon](https://github.com/o3co/ts.hocon) | TypeScript | [npm](https://www.npmjs.com/package/@o3co/ts.hocon) | TypeScript/Node.js 向け HOCON パーサー |\n| [rs.hocon](https://github.com/o3co/rs.hocon) | Rust | [crates.io](https://crates.io/crates/o3co-hocon) | Rust 向け HOCON パーサー |\n\nすべての実装が Lightbend HOCON 仕様に完全準拠しています。\n\n## ベストプラクティス\n\n### CI/CD 統合\n\n- CI パイプラインでデプロイ前に `hocon2json -validate` で HOCON の構文をチェックしましょう\n- `-env-file` を使えばシェル環境を汚さずに環境別変数を注入できます\n\n### CI での設定バリデーション\n\n```yaml\n# 例: GitHub Actions\n- name: Validate config\n  run: hocon2json -validate config/prod.conf\n```\n\n### 複数ファイルのマージ\n\n- マージ順序が重要: 後のファイルが前のファイルを上書きします\n- `base.conf` + `env.conf` パターンで環境別のオーバーライドを行いましょう:\n\n  ```bash\n  hocon2json base.conf prod.conf \u003e config.json\n  ```\n\n## ライセンス\n\nApache 2.0 — [LICENSE](LICENSE) を参照。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fo3co%2Fhocon2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fo3co%2Fhocon2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fo3co%2Fhocon2/lists"}