What is HCL?
HCL (HashiCorp Configuration Language) is the human-friendly configuration syntax used by Terraform, Packer, Nomad, Consul, and Vault. It is a superset of JSON in spirit — every HCL document can be expressed as JSON, which is the format Terraform actually uses internally for module loading and JSON-syntax overrides.
Why convert HCL to JSON?
Three common reasons. First, programmatic editing — JSON is trivial for scripts to read and modify, while HCL needs a real parser. Second, Terraform itself accepts .tf.json files as a first-class alternative to .tf, useful when configuration is generated by code. Third, integration with non-HashiCorp tools (cost estimators, policy engines, dashboards) that read JSON.
Does this tool support all HCL features?
It supports the static configuration subset most engineers actually write: blocks with labels, attributes, strings (with escapes), numbers, booleans, null, lists, maps, comments, and heredocs. Interpolation expressions like ${var.region} are preserved as raw strings — they are evaluated by Terraform at plan time, not at parse time, so a static converter cannot resolve them.
Is the conversion lossless?
For static data — yes. Comments are stripped (JSON has no comments) and whitespace is normalised. Block labels become nested object keys, repeated blocks merge into arrays, and interpolation strings round-trip as-is. Function calls (e.g. lookup(...)) and conditional expressions are preserved verbatim as strings.
Can I run Terraform on the JSON output?
Yes — save the output as filename.tf.json and Terraform will load it alongside .tf files. Note that JSON-syntax Terraform requires interpolation in string form ("${var.x}"), which is exactly what this converter produces.
Is my HCL uploaded?
No. Tokenization and parsing happen entirely in JavaScript inside your browser. Configuration files often contain ARNs, project names, and account identifiers — none of it leaves the device. You can verify in DevTools → Network: clicking Convert produces zero requests.
How does this differ from terraform show -json?
terraform show -json runs after plan/apply and emits the full state with resolved values, references, and provider metadata. This converter operates on raw .tf source — it parses what you wrote, not what Terraform computed. Use terraform show for live state; use this tool for source-level transformation.
Does it handle multi-line strings (heredocs)?
Yes. Both <<EOT … EOT and <<-EOT … EOT (with leading-whitespace trimming) are recognised. The body becomes a regular JSON string with embedded newlines.