# How can I parse a JSON secret to YAML?

**URL:** <https://discuss.hashicorp.com/t/how-can-i-parse-a-json-secret-to-yaml/30138>\
**Category:** Vault\
**Created:** [September 30, 2021, 3:38pm UTC](https://discuss.hashicorp.com/t/how-can-i-parse-a-json-secret-to-yaml/30138 "2021-09-30T15:38:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ay0](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/ay0/32/22641_2.png) [@Ay0](https://discuss.hashicorp.com/u/Ay0)\
**Post date:** [September 30, 2021, 3:38pm UTC](https://discuss.hashicorp.com/t/how-can-i-parse-a-json-secret-to-yaml/30138/1 "2021-09-30T15:38:33Z")

</div>

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:

```auto
          {{`{{- with secret "secret/foo" -}}`}}
          {{`{{ with .Data.data | parseYAML }}`}}
          {{`{{- end }}`}}
          {{`{{- end }}`}}

```

but I’m always greeted with this error:

```auto
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 {}"

```
