Commit Graph

4 Commits

Author SHA1 Message Date
Martin Atkins
dcefc5ca24 hclpack: Body can now unmarshal from JSON
This allows us to round-trip Body to JSON and back without any loss as
long as the expression source codes are always valid UTF-8, and we require
that during expression parsing anyway so that is a fine restriction.

The JSON encoding is a little noisy to read due to the extra annotations
required to be lossless (including source ranges) but still relatively
compact due to the base64-VLQ encoding of the source location information.
2018-11-11 09:22:08 -08:00
Martin Atkins
06d5709118 hclpack: Support literal JSON as an additional expression syntax
hclpack can potentially be used as an intermediary to more easily bring
non-HCL input into the HCL API, and so allowing a literal value in JSON
format as an expression type means that such a transcoder doesn't need to
worry about formatting values it encounters using HCL syntax and can
instead just encode directly to JSON, but at the expense of then not being
able to use the full expression/template syntax.
2018-11-11 08:26:37 -08:00
Martin Atkins
309e278914 hclpack: Implement JSON marshaling (but not unmarshaling, yet) 2018-11-11 03:25:19 +00:00
Martin Atkins
227ba9e86b hclpack: Start of definitions for JSON marshaling/unmarshaling
This is not yet complete.
2018-11-10 10:29:32 -08:00