Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

toJson and mustToJson fail when presented with a "map[interface {}]interface {}" #63

Open
drivera-armedia opened this issue Aug 23, 2024 · 0 comments

Comments

@drivera-armedia
Copy link

drivera-armedia commented Aug 23, 2024

I'm unable to convert a (map) section of the values file to JSON because of this error:

$ gucci -f test.yaml < g.tpl 

    V (map):Failed to parse standard input: template: -:4:34: executing "-" at <mustToJson>: error calling mustToJson: json: unsupported type: map[interface {}]interface {}

This is on version v1.6.13, on linux-amd64. I realize this is probably a Strig thing, but maybe there's a newer version of Strig which can be used? Maybe there's a type cast that can be performed?

Here's the template file:

{{- $l := list $.testTwo $.testTwo -}}
{{- range $i := $l }}
  {{- range $j := $i }}
    V ({{ kindOf $j }}): {{ $j | mustToJson | nindent 2 }}
  {{- end }}
{{- end }}

And here's a YAML file that triggers the issue:

testOne:
- name: common
  type: common-use-stuff
  version: "1.0"
- name: shovel
  type: ""
  version: "2.0.0"
- name: gardener
  type: ""
  version: "3.1.0"

testTwo:
- name: common
  repository: "some stuff for common use"
  version: "3.1.0"
- name: shovel
  version: "2.1.0"
- name: gardener
  version: "3.2.0"
- name: chauncey
  version: "3.9.0"

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant