func Unmarshal(buf []byte, t cty.Type) (cty.Value, error) {
	var path cty.Path
	return unmarshal(buf, t, path)
}
Unmarshal decodes a JSON representation of the given value into a cty Value
conforming to the given type.

While decoding, type conversions will be done where possible to make
the result conformant even if the types given in JSON are not exactly
correct. If conversion isn't possible then an error is returned, which
may be a cty.PathError.
package json
import (
	"bytes"
	"github.com/zclconf/go-cty/cty"
	"github.com/zclconf/go-cty/cty/convert"
)
func Marshal(val cty.Value, t cty.Type) ([]byte, error) {
	errs := val.Type().TestConformance(t)
	if errs != nil {
		var err error
		val, err = convert.Convert(val, t)
		if err != nil {
			return nil, err
		}
	}
	buf := &bytes.Buffer{}
	var path cty.Path
	err := marshal(val, t, path, buf)
	if err != nil {
		return nil, err
	}
	return buf.Bytes(), nil
}