title: Elixir - JasonHelpers - How can I send a keyword list to json_map?
body: <p>I have a data structure that I want to convert to json and preserve the key order.</p>
  
  <p>For example:
  <code>%{ x: 1, a: 5}</code> should be converted to <code>"{\"x\": 1, \"a\": 5}"</code></p>
  
  <p>Poison does it without any problem. But when I upgrade to Jason, it changes to <code>"{\"a\": 5, \"x\": 1}"</code>.</p>
  
  <p>So I use JasonHelpers json_map to preserve the order like this:</p>
  
  <pre><code>Jason.Helpers.json_map([x: 1, a: 5])
  </code></pre>
  
  <p>It creates a fragment with correct order.</p>
  
  <p>However, when I use a variable to do this:</p>
  
  <pre><code>list = [x: 1, a: 5]
  Jason.Helpers.json_map(list)
  </code></pre>
  
  <p>I have an error:</p>
  
  <pre><code>** (Protocol.UndefinedError) protocol Enumerable not implemented for {:list, [line: 15], nil} of type Tuple.
  ....
  </code></pre>
  
  <p><strong>QUESTION:</strong> How can I pass a pre-calculated list into <code>Jason.Helpers.json_map</code> ?</p>
  
  <p>The calculation is complicated, so I don't want to repeat the code just to use json_map, but use the function that returns a list.</p>