<p>I have a HELM values file which looks like so:</p>

<pre><code>service:
  environment: dev
  spring_application_json: &gt;-
    {
      "spring" : {
        "boot" : {
          "admin" : {
            "client" : {
              "enabled" : "false",
              "url" : "http://website1",
              "instance" : {
                "service-base-url" : "http://website2",
                "management-base-url" : "http://website3"
              }
            }
          }
        }
      }
    }
</code></pre>

<p>And a corresponding template file which grabs this value and inserts it as an environment variable to a container.</p>

<pre><code>spec:
  replicas: {{ .Values.replicaCount }}
  template:
    spec:
      imagePullSecrets:
        - name: {{ .Values.image.pullSecret }}
      containers:
        - name: {{ .Chart.Name }}
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          env:
            - name: ENVIRONMENT
              value: "{{ .Values.service.environment }}"
            - name: SPRING_APPLICATION_JSON
              value: "{{ .Values.service.spring_application_json }}"
</code></pre>

<p>However when I run the helm install I get the following error:</p>

<pre><code>Error: YAML parse error on deployment.yaml: error converting YAML to JSON: yaml: line 40: did not find expected key
</code></pre>

<p>Which points to the line:</p>

<pre><code>value: "{{ .Values.service.spring_application_json }}"
</code></pre>

<p>I believe its a problem with the way I'm trying to parse in a json string as a multiline environment variable?  The ENVIRONMENT 'dev' variable works perfectly and this same YAML also works perfectly with docker-compose.</p>

<p>There's an example a bit like this in the docs for <a href="https://docs.spring.io/autorepo/docs/spring-cloud-dataflow-server-kubernetes-docs/1.2.x/reference/html/_spring_cloud_deployer_for_kubernetes_properties.html#_using_spring_application_json" rel="noreferrer">spring cloud dataflow</a> but the format in their documentation has the quotes escaped.</p>

<p>I was able to recreate the error and get past it by changing the values file entry to:</p>

<pre><code>service:
  spring_application_json:
    {
      "spring" : {
        "boot" : {
          "admin" : {
            "client" : {
              "enabled" : "false",
              "url" : "http://website1",
              "instance" : {
                "service-base-url" : "http://website2",
                "management-base-url" : "http://website3"
              }
            }
          }
        }
      }
    }
</code></pre>

<p>And the deployment entry to:</p>

<pre><code>    - name: SPRING_APPLICATION_JSON
      value: {{ .Values.service.spring_application_json | toJson | quote }}
</code></pre>

<p>Notice no quotes around this part as that is handled anyway.</p>
