title: Is there a well-typed Scala (or Java) library to consume JSON Web APIs?
body: <p>I want a simple rest client library for Java (or Scala) that let's me easily do GETs/PUTs/POSTs/DELETEs etc on a JSON REST API and deserialize the JSON responses into Java objects in a type-safe way e.g.</p>
  
  <pre><code>RestClient client = new RestClient("http://api.mycompany.com").withAuth(Auth.Basic, username, password);
  // This basically deserializes the JSON response into a POJO    
  MyDocument[] result = client.get("/document?limit=10", MyDocument[].class);
  MyFriend friend = client.post("/friend/Joe", body, MyFriend.class); 
  </code></pre>
  
  <p>Basically I want the generic signature to be something like this for <code>get()</code> e.g.
  <code>public &lt;T&gt; T get(String path, Class&lt;T&gt; responseClass)</code> which would do a GET request and deserialize the JSON response into a POJO of type <code>responseClass</code></p>
  
  <p>I did find a library that is pretty close to what I want called <a href="http://sitebricks.org/#webclient" rel="nofollow">sitebricks</a> but it is severely limited in its scope e.g. it does not allow me to do more uncommon HTTP verbs like PUT/PATCH/DELETE and it has no way of setting headers or even the body of a request.</p>
  
  <p><a href="https://github.com/foursquare/foursquare-fhttp" rel="nofollow">Another library</a> I found has the opposite problem - it has no way of doing basicauth and it does not serialize JSONs back into objects for you.</p>