hcl to json produces an unexpected result
- Dominant language
- Go
- Stars
- 5.8k
- Forks
- 659
- Avg merge
- 20h 36m
- Merged PRs (30d)
- 6
Description
### HCL Template
```hcl
variable "ami" {
description = "the AMI to use"
}
```
According to the documentation the JSON equivalent is:

But Actually.. when using json2hcl --reverse on that hcl template, the output is this:
```json
{
"variable": [
{
"ami": [
{
"description": "the AMI to use"
}
]
}
]
}
```
So.. What's going on here? Is the documentation bad? is the decoder broken?
There is vast difference between holding these values nested in an array or not in an array
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the HCL example with `json2hcl --reverse` and compare its JSON output with the documented equivalent. Determine whether the decoder or the documentation is inconsistent, then make the behavior and expected nested-array structure agree.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100