https://github.com/winebarrel/json2hcl
A tool to convert JSON to HCL.
https://github.com/winebarrel/json2hcl
golang hcl json
Last synced: 11 months ago
JSON representation
A tool to convert JSON to HCL.
- Host: GitHub
- URL: https://github.com/winebarrel/json2hcl
- Owner: winebarrel
- License: mit
- Created: 2024-03-31T06:06:42.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-07-07T19:00:44.000Z (12 months ago)
- Last Synced: 2025-07-07T20:29:11.384Z (12 months ago)
- Topics: golang, hcl, json
- Language: HCL
- Homepage:
- Size: 78.1 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# json2hcl
[](https://github.com/winebarrel/json2hcl/actions/workflows/ci.yml)
A tool to convert JSON to HCL.
### Usage
## Installation
```sh
brew install winebarrel/json2hcl/json2hcl
```
## Usage
```go
Usage: json2hcl [OPTION] [FILE]
-version
print version and exit
```
```sh
$ cat policy.json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "service-prefix:action-name",
"Resource": "*",
"Condition": {
"DateGreaterThan": {"aws:CurrentTime": "2020-04-01T00:00:00Z"},
"DateLessThan": {"aws:CurrentTime": "2020-06-30T23:59:59Z"}
}
}
]
}
$ json2hcl policy.json # or `cat policy.json | json2hcl`
{
Statement = [{
Action = "service-prefix:action-name"
Condition = {
DateGreaterThan = {
"aws:CurrentTime" = "2020-04-01T00:00:00Z"
}
DateLessThan = {
"aws:CurrentTime" = "2020-06-30T23:59:59Z"
}
}
Effect = "Allow"
Resource = "*"
}]
Version = "2012-10-17"
}
```