Groovy script to transform xml to json <p>I have the following groovy script that transforms an xml into json.</p> <p><a href="http://stackoverflow.com/a/24647389/2165673">http://stackoverflow.com/a/24647389/2165673</a></p> <p>Here is my xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;Response xmlns=""&gt; &lt;ProgressResult xmlns:i="http://www.w3.org/2001/XMLSchema-instance"&gt; &lt;ErrorMessage&gt;error &lt;/ErrorMessage&gt; &lt;IsSuccessful&gt;false&lt;/IsSuccessful&gt; &lt;/ProgressResult&gt; &lt;/ProgressResponse&gt; </code></pre> <p>The JSON result i need is </p> <pre><code>{ "IsSuccessful" : "false", "ErrorMessage" : "Something Happened" } </code></pre> <p>but i am getting the following <a href="http://www.tiikoni.com/tis/view/?id=b4ce664" rel="nofollow">http://www.tiikoni.com/tis/view/?id=b4ce664</a></p> <p>I am trying to improve my groovy script but i just started using it and it has a steep learning curve. Can someone help direct me to the right direction?</p> <p>Thanks!!</p>