<p>I have defined an object with a few attributes in my <code>values.yaml</code> file:</p>

<pre><code>serverOptions:
    defaultUrl:
        p1: abc
        p2: def
    cpu_request:
        p1: abc
        p2: def
    mem_request:
        p1: abc
        p2: def
</code></pre>

<p>I am saving these data to a <code>server_options</code> json file in <code>configmap.yaml</code> using this code:</p>

<pre><code>data:
    server_options.json: |
        {{ toJson .Values.serverOptions }}
</code></pre>

<p>It works but the initial "list" of attributes gets alphabetically ordered. This is the file's content</p>

<blockquote>
  <p>{"cpu_request":{"p1":"abc","p2":"def"},"defaultUrl":{"p1":"abc","p2":"def"},"mem_request":{"p1":"abc","p2":"def"}}</p>
</blockquote>

<p>Is there a way to keep the original ordering?</p>

Naigel
<p>Json dictionaries aren't ordered, so no that's not possible. They may be alphabetically ordered when printed but that's only for readability.</p>
