How can I parse a JSON secret to YAML?

I have a secret containing a somewhat big structure. The container expects a YAML, but as Vault only stores JSON, I converted it to JSON.

The structure is complex as to trying to come up with a template to parse it. However, reading about Consult templates, I found the parseYAML function. How can I use it in Vault?

I was trying this or similar approaches:

          {{`{{- with secret "secret/foo" -}}`}}
          {{`{{ with | parseYAML }}`}}
          {{`{{- end }}`}}
          {{`{{- end }}`}}

but I’m always greeted with this error:

ERROR] runtime error encountered: error="template server: (dynamic): execute: template: :2:21: executing "" at <parseYAML>: wrong type for value; expected string; got map[string]interface {}"