title: Consuming and API with Scala Dispatch Same method two different JSON
body: <p>I 'm consuming a REST API, When the call goes OK, this API return a 200 OK Header, Then in the body it can handle two different JSONs </p>
  
  <pre><code>{"Error": {
     "code" = 1
     "msg" = "some error message"
    }
  }
  </code></pre>
  
  <p>Or if the data send was correct, it returns</p>
  
  <pre><code>{"code" : {
    "status" = "Your submission is ..."
    "msg" = "It is happy"
    "answer" = {...}
  }
  </code></pre>
  
  <p>The problem is that, If I use json4s, I must known which case class to use, what should I do, Use <code>Either[Error,Code]</code>, after converting the JValue to String and check if contains Error then  Left(Error) o else Right(Code), which solution should I Take. I'm looking for a good solution, and maybe a correct explanation about that.</p>
  
  <p>The problem of my aprrocach is that Dispatch gives me <code>Either[String, JsValue]</code> so finally I will get Either[String,Either[Error,Code]], and it seems not a good object</p>