HCL to JSON Converter - Convert Terraform Online
Convert HCL (HashiCorp Configuration Language) to JSON online for free.
How to Convert HCL to JSON
Paste HCL Configuration
Paste your HCL configuration from Terraform (.tf files), Vault, or Consul, or upload an .hcl file directly.
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 scripts, 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.