Convert JSON to HCL

Convert JSON to HashiCorp Configuration Language (HCL) instantly in your browser. Perfect for Terraform configs, Vault policies, and Consul settings. No upload required.

By ChangeThisFile Team · Last updated: March 2026

Quick Answer

ChangeThisFile converts JSON to HCL instantly in your browser with no file upload. Drop your JSON file, get HCL back in seconds for Terraform, Vault, or Consul. Free, private, and works offline.

Free No signup required Files stay on your device Instant conversion Updated March 2026

Convert JSON to HCL

Drop your JSON file here to convert it instantly

Drag & drop your .json file here, or click to browse

Convert to HCL instantly

JSON vs HCL: Format Comparison

Key differences between the two formats

FeatureJSONHCL
Syntax styleJavaScript-basedHashiCorp native
CommentsNot supported# and /* */ comments
String interpolationStatic strings only${var.name} expressions
HeredocsEscaped strings only<<EOF multiline EOF
Terraform compatibilityRequires conversionNative support
Human readabilityGood for dataOptimized for config
NestingJSON objects/arraysBlocks and arguments
Variable referencesString values onlyDirect variable syntax

When to Convert

Common scenarios where this conversion is useful

Terraform configuration migration

Convert JSON-formatted Terraform configs to native HCL syntax for better readability, comments, and HashiCorp tooling compatibility.

API response to Terraform data source

Transform JSON API responses into HCL data source blocks for importing external configurations into Terraform state management.

Vault policy authoring

Convert JSON policy definitions to HCL format for HashiCorp Vault access control policies with improved syntax highlighting and validation.

Consul configuration setup

Migrate JSON-based Consul service definitions and KV store configurations to HCL for better DevOps workflow integration.

Infrastructure as Code standardization

Standardize configuration files across HashiCorp toolchain by converting legacy JSON configs to HCL for consistent team workflows.

Who Uses This Conversion

Tailored guidance for different workflows

For DevOps Engineers

  • Convert JSON-formatted Terraform configurations to native HCL for better team collaboration and tooling support
  • Migrate legacy JSON infrastructure definitions to HCL for improved readability and maintainability
  • Transform API-generated JSON configs into HCL for infrastructure-as-code workflows
Validate converted HCL with 'terraform validate' before applying changes to infrastructure
Add meaningful comments and variable interpolations after conversion to leverage HCL's advantages over JSON

For Cloud Architects

  • Standardize multi-cloud configurations by converting vendor JSON outputs to HashiCorp HCL format
  • Create reusable HCL modules from JSON configuration templates for consistent infrastructure patterns
Use HCL's variable interpolation features to make configurations more dynamic and environment-specific
Organize converted configurations into logical modules for better infrastructure governance

For Platform Teams

  • Convert JSON-based service definitions to HCL for Consul service mesh configuration management
  • Migrate Vault policy JSON files to HCL for better policy version control and team review processes
Establish HCL formatting standards using 'terraform fmt' after conversion for consistent code style
Implement proper variable management and secrets handling in converted HCL configurations

How to Convert JSON to HCL

  1. 1

    Drop your JSON file

    Drag and drop your JSON file onto the converter, or click to browse and select your configuration file.

  2. 2

    Convert instantly

    The conversion happens automatically in your browser using client-side JavaScript. No server upload needed.

  3. 3

    Download the HCL result

    Click Download to save your converted HCL file, ready for use with Terraform, Vault, or Consul.

Frequently Asked Questions

Yes, completely free with no limits. ChangeThisFile runs entirely in your browser, so there are no server costs or usage restrictions.

No. All conversion happens locally in your browser using JavaScript. Your JSON and HCL files never leave your device, ensuring complete privacy.

Yes, the output follows standard HCL syntax compatible with Terraform, Vault, Consul, and other HashiCorp tools. You may need to adjust variable references for your specific use case.

JSON objects become HCL blocks, arrays become lists, and nested objects create block hierarchies. String values are preserved, but you can manually add variable interpolations afterward.

Yes, the converter handles deeply nested JSON structures, arrays, and complex objects. It preserves the logical structure while adapting to HCL's block-based syntax.

JSON doesn't support comments, so there are none to preserve. However, the converted HCL allows you to add # or /* */ comments afterward for better documentation.

Yes, it converts terraform.json files and JSON-based resource definitions to proper HCL resource blocks, data sources, and variable declarations.

Absolutely. JSON-formatted Vault policies convert cleanly to HCL syntax, making them easier to read, edit, and version control in your infrastructure repository.

JSON arrays become HCL lists using square bracket notation. Complex arrays with objects become lists of blocks, maintaining the original data structure.

No hard limit since conversion happens in your browser. Very large files may take longer to process, but typical configuration files convert instantly.

The HCL syntax will be valid, but you may need to adjust variable references, add interpolations, or modify resource names to match your specific infrastructure setup.

The converter focuses on structural transformation from JSON to HCL. Use 'terraform validate' or 'hcl fmt' after conversion to ensure syntax correctness for your specific tool.

Related Conversions

Related Tools

Free tools to edit, optimize, and manage your files.

Need to convert programmatically?

Use the ChangeThisFile API to convert JSON to HCL in your app. No rate limits, up to 500MB files, simple REST endpoint.

View API Docs
Read our guides on file formats and conversion

Ready to convert your file?

Convert JSON to HCL instantly — free, no signup required.

Start Converting