HCL v2 Parser for JavaScript

JSON →
library 1.0.3 ·javascript
verified May 27, 2026

hcl2-parser is a JavaScript library designed for parsing HashiCorp Configuration Language (HCL) version 2 strings, providing crucial utility for developers working with Terraform configurations or other systems that utilize HCLv2. It offers functions to convert HCL input into either a JSON string or a JavaScript object. A key differentiator for this package is its support for the newer HCL v2 syntax, which includes features like for-expressions, dynamic blocks, and null values, an capability often lacking in other JavaScript-based HCL parsers. The library achieves this by wrapping the Go-based `tmccombs/hcl2json` tool and transpiling the necessary Go code to JavaScript using GopherJS, resulting in a self-contained npm package. As of its initial stable release, version 1.0.3, the package includes TypeScript definitions and is primarily intended for use within Node.js environments. Its release cadence is currently nascent.

total hits 14
actors 7 distinct systems
last hit 5d ago MetaBot
MetaBot
4
OAI-SearchBot
2
Script
1
ChatGPT-User
1
Search engines
1

top countries 🇺🇸 United States · 🇳🇴 Norway · 🇨🇦 Canada · 🇫🇷 France · 🇩🇪 Germany