title: Groovy map must be converted to JSON object with numerical object key
body: <p>I am doing some processing with Groovy/Grails and the results are a map of type <code>&lt;String, Float&gt;</code>.</p>
  
  <p>When returning the JSON object to the calling function (in this case, it's a flot diagram which requires [number,number] format), the key needs to be a number. This, in theory, is fine as my key to the map is a number in string form. I can't, however, figure out a way to create the JSON object with a numerical key.</p>
  
  <p>I get results like this:</p>
  
  <pre><code>{"1":-9.814244910221474,"2":-9.710478606504552,"3":-9.636841089398253,"4":-9.524104819110796,"5":-9.522597036735684 ...}
  </code></pre>
  
  <p>instead of:</p>
  
  <pre><code>{1:-9.814244910221474,2:-9.710478606504552,3:-9.636841089398253,4:-9.524104819110796,5:-9.522597036735684 ...}
  </code></pre>
  
  <p>Does anyone know a way to force the JSON Map.encodeAsJSON() to produce an integer key? I've tried explicitly creating a map of type &lt; integer,integer > before encoding it, and that doesn't work either.</p>