title: Decoding the Base64 string in Grails
body: <p>I am developing a web API in which I am sending data from the app in JSON format which contains an image as a base64 string that I need to decode on the server. </p>
  
  <p>Below is the code where I am decoding the string</p>
  
  <pre><code>def imageString=object.image
  Base64 coder = new Base64()
  def decode=coder.decode(imageString)
  </code></pre>
  
  <p>which throws this error:</p>
  
  <blockquote>
    <p>Cannot cast object '[B@6aec0bd1' with class '[B' to class 'javax.ws.rs.core.Response'. Stacktrace follows:
    Message: Cannot cast object '[B@6aec0bd1' with class '[B' to class 'javax.ws.rs.core.Response'</p>
  </blockquote>
  
  <p>What is a possible solution for this?</p>