title: Serializing groovy map to string with quotes
body: <p>I'm trying to persist a groovy map to a file. My current attempt is to write the string representation out and then read it back in and call <code>evaluate</code> on it to recreate the map when I'm ready to use it again.</p>
  
  <p>The problem I'm having is that the <code>toString()</code> method of the map removes vital quotes from the values of the elements. When my code calls evaluate, it complains about an unknown identifier.</p>
  
  <p>This code demonstrates the problem:</p>
  
  <pre><code>m = [a: 123, b: 'test']
  print "orig: $m\n"
  
  s = m.toString()
  print " str: $s\n"
  
  m2 = evaluate(s)
  print " new: ${m2}\n"
  </code></pre>
  
  <p>The first two print statements almost work -- but the quotes around the value for the key <code>b</code> are gone. Instead of showing <code>[a: 123, b: 'test']</code>, it shows <code>[a: 123, b: test]</code>.</p>
  
  <p>At this point the damage is done. The <code>evaluate</code> call chokes when it tries to evaluate <code>test</code> as an identifier and not a string.</p>
  
  <p>So, my specific questions:</p>
  
  <ol>
  <li>Is there a better way to serialize/de-serialize maps in Groovy?</li>
  <li>Is there a way to produce a string representation of a map with proper quotes?</li>
  </ol>