Convert HCL to JSON Online
Convert HashiCorp HCL to JSON online for Terraform configuration review, infrastructure as code workflows, and developer tooling.
How to use HCL to JSON Converter
Paste content into the hcl input panel.
Run the converter to generate the target format instantly.
Copy or download the result once it looks right.
What this tool helps you do
Paste, convert, and copy results quickly
Useful for APIs, configuration files, and structured text
Sample input is built in for quick testing
Download the converted output as a file
Why this helps in text and data workflows
Inspecting a Terraform variable block or resource definition by converting it to JSON for easier programmatic reading.
Debugging a Terraform module configuration by converting HCL to JSON to compare with expected structure.
Converting a terraform.tfvars-style HCL file to JSON so an automation script or CI pipeline can read it.
Reviewing the output of a Terraform plan or state section that is easier to parse as JSON than as raw HCL.
Common problems and fixes
The converter returns an error for what looks like valid Terraform HCL.
This converter handles standard HCL syntax. Some Terraform-specific functions and expressions — like templatefile(), for_each, or dynamic blocks — are Terraform language extensions and not standard HCL. Simplify the input to core variable and block definitions.
The JSON output has unexpected array wrapping around block values.
HCL blocks that share the same label are collected into arrays in JSON. A single resource block becomes a one-item array. This is correct HCL-to-JSON mapping behaviour.
String interpolations like ${var.name} appear as-is in the JSON output.
String interpolations are Terraform expressions evaluated at plan time, not plain HCL values. The converter outputs them as literal strings since it cannot resolve variables. This is expected.
Related tools
Related Guides
Frequently asked questions
How do I convert HCL to JSON?
Paste your HashiCorp HCL into the input box, run the converter, and copy or download the formatted JSON output.
Does this HCL to JSON converter work for Terraform-style HCL?
Yes. The converter is intended for HashiCorp HCL and Terraform-style configuration input.
Is this HCL to JSON converter free?
Yes. It is free to use on the site.
What is HCL?
HCL stands for HashiCorp Configuration Language. It is a structured configuration language designed by HashiCorp and used primarily in Terraform, Packer, and other HashiCorp tools.
Why would I convert HCL to JSON?
JSON is easier to process programmatically. Converting HCL to JSON lets scripts, CI pipelines, and automation tools read infrastructure configuration without needing an HCL parser.
Can I convert JSON back to HCL?
Yes. Use the JSON to HCL converter to go in the other direction.