Giter Site home page Giter Site logo

hcl2json's Introduction

hcl2json

This is a tool to convert from HCL to json, to make it easier for non-go applications and scripts to process HCL inputs (such as terraform config).

If passed the -pack option, it converts to the JSON pack format used by hclpack, which contains the original structure of the document. However, all it has for expressions is the source text, which isn't always very useful.

If no options are passed, it converts the native HCL file to an (almost) equivalent HCL JSON file. Note, however, that there are some corner cases where it may not be exactly equivalent, especially if the target application makes use of static analysis.

Alternatives

At the time this project created, there weren't really any other object. However, the HCL project itself now includes an hcldec command that can convert hcl to json if you give it a specification. One advantage of hcl2json is it doesn't require a specification, so for use cases where the heuristics are correct it may be easier to use. However, if you have cases hit the limitations of conversion listed above, hcldec is probably a better fit.

Installation

Mac OS

Install with Homebrew:

brew install hcl2json

hcl2json can also be installed via MacPorts:

sudo port install hcl2json

Others

Prebuilt binaries are available on the releases page. There is also a docker image on dockerhub.

Alternatively you can build from source (see next section).

Building

You can build and install hcl2json using go get. Since hcl2json uses Go modules, you will need to run this as GO11MODULE=on go get github.com/tmccombs/hcl2json.

Alternatively, you can clone and build the repository:

$ git clone https://github.com/tmccombs/hcl2json
$ cd hcl2json
$ go build

This will build an hcl2json executable in the directory.

hcl2json's People

Contributors

tmccombs avatar dependabot[bot] avatar jpreese avatar bsick7 avatar shurikk avatar rulerof avatar herbygillot avatar hoshsadiq avatar picatz avatar mmorel-35 avatar prupe avatar sirlatrom avatar userhas404d avatar yorinasub17 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.