How to serialize groovy object to groovy code

  [[a: [x: 1]], [b: [y: 2]]].inspect()=='[[\'a\':[\'x\':1]], [\'b\':[\'y\':2]]]'