HCL to JSON Converter - Convert Terraform Online
Free HCL to JSON Converter for Terraform, Vault, and Consul
How to Convert HCL to JSON
Convert HashiCorp Configuration Language (HCL) from Terraform, Vault, and Consul to JSON format online for free.
Paste HCL Configuration
Paste your HCL configuration from Terraform (.tf files), Vault, or Consul, or upload an .hcl file directly.
Example: Terraform HCL Configuration
Copy and paste this HCL example to see how it works:
resource "aws_instance" "web" { ami = "ami-0c55b159cbfafe1f0" instance_type = "t2.micro" tags { Name = "web-server" Environment = "production" } }
Automatic Conversion
The converter parses HCL syntax and converts it to equivalent JSON structure instantly. All resource blocks, variables, and nested configurations are preserved.
Download or Copy JSON
Copy the converted JSON to your clipboard or download as a .json file for use in CI/CD pipelines, or configuration tools.
What is HCL (HashiCorp Configuration Language)?
HCL (HashiCorp Configuration Language) is a configuration language created by HashiCorp for their infrastructure tools. It's designed to be both human-readable and machine-friendly, making it ideal for infrastructure as code.
HCL is used by Terraform for defining cloud infrastructure, Vault for security policies, and Consul for service configurations. While HCL is more readable than JSON, converting to JSON can be useful for programmatic processing or integration with tools that only accept JSON input.
Frequently Asked Questions
What is HCL used for?
HCL is the configuration language for HashiCorp tools like Terraform, Vault, and Consul. It's designed to be readable and easy to write for infrastructure as code.
Can Terraform use JSON instead of HCL?
Yes, Terraform supports JSON configuration files with .tf.json extension. While HCL is recommended, JSON works for machine-generated configs.
Why convert HCL to JSON?
JSON format allows processing with standard tools, integration with systems that don't support HCL, or programmatic manipulation of Terraform configurations.
Are HCL comments preserved?
No, JSON doesn't support comments. Comments are removed during conversion, which is a limitation of the JSON format.
Is this tool free?
Yes, completely free with unlimited conversions. No registration or file size limits.
Related Tools
JSON to HCL
Convert JSON to HashiCorp Configuration Language for Terraform
HCL Formatter
Format and beautify HCL/Terraform configuration files with proper indentation
HCL Validator
Validate HCL/Terraform syntax and structure with error detection
HCL Fixer
Fix broken HCL/Terraform files automatically, repair syntax errors, missing braces, and malformed blocks
HCL to YAML
Convert Terraform HCL configuration to YAML format
YAML to HCL
Convert YAML configuration to Terraform HCL format