Developer Tools

HCL ⇄ JSON ⇄ YAML Converter

Convert between Terraform HCL, JSON and YAML in any direction. Pretty-prints and validates as you type. Everything runs in your browser — nothing is sent over the network.

Free Tool100% LocalLive Validation
Privacy: all parsing happens client-side. No backend, no logging.

About this converter

Cloud architects and engineers juggle three configuration languages every day: Terraform's HCL, JSON for tooling and APIs, and YAML for Kubernetes, CI pipelines and Ansible. This converter does the round trip — paste any one of them, get the other two. Useful for codegen, debugging, migrating tools, or just understanding what a config actually says.

Supported HCL syntax

  • Attributes (key = value) with strings, numbers, booleans, null
  • Lists and inline objects
  • Blocks with zero, one, or multiple labels
  • Line comments (#, //) and block comments (/* */)
  • Repeated blocks of the same type

Not supported (yet)

  • Heredoc strings (<<EOF)
  • Interpolations ($${var.foo})
  • References, expressions, operators, functions

Encountering any of these produces a clear error pointing at the offending line and column. Convert the structural part separately and re-add expressions manually on the other side.

Frequently Asked Questions

Is this converter safe to use with confidential config files?
Yes. The converter runs entirely in your browser. Your config is never sent to a server. Open your DevTools → Network tab and paste a config — you'll see nothing happen.
How does HCL map to JSON?
Block labels become nested object keys. The HCL block resource "aws_instance" "web" { ami = "..." } becomes { "resource": { "aws_instance": { "web": { "ami": "..." } } } } — the same convention Terraform itself uses for its JSON syntax.
Are comments preserved?
No. The converter operates on structural data only. Comments in any of the three formats are dropped on conversion.
Can I use the same format on both sides?
Yes — that gives you a validator and pretty-printer for that format. Useful for sanity-checking a YAML file or normalising the indentation of JSON.