Best way to parse JSON code to HCL on the frontend

Hi!

I am looking for a recommended way to parse JSON code into HCL format strictly on the front end in Typescript. Is there a current package that does this?

Can you provide an example? I’m confused about what you mean by “on the frontend.”

Yes! Try json2tf.

1 Like

This was flagged as spam so let me try again without a link. If you search “json2tf” on the NPM registry, it’s a package that converts a JSON object to a Terraform literal. Sounds like exactly what you’re looking for. Fair disclosure: I wrote it.

Thanks for this response, i will check later and respond your thread.

1 Like

The package in node is good for me too, i understand now what do you need.

You may check out “gohcl” and “determined” in github.