private Object decodeBody(Response response, Type type, Reader reader) throws IOException {
    if (String.class.equals(type)) return Util.toString(reader);
    JSONTokener tokenizer = new JSONTokener(reader);
    if (JSONObject.class.isAssignableFrom((Class<?>) type)) return new JSONObject(tokenizer);
    else if (JSONArray.class.isAssignableFrom((Class<?>) type)) return new JSONArray(tokenizer);
    else
      throw new DecodeException(
          response.status(),
          format("%s is not a type supported by this decoder.", type),
          response.request());
  }
Decodes responses using JSON-java.

<p>Basic example with {@link feign.Feign.Builder}:

<pre>
  interface GitHub {

    {@literal @}RequestLine("GET /repos/{owner}/{repo}/contributors")
    JSONArray contributors({@literal @}Param("owner") String owner, {@literal @}Param("repo") String repo);

  }

  GitHub github = Feign.builder()
                     .decoder(new JsonDecoder())
                     .target(GitHub.class, "https://api.github.com");

  JSONArray contributors = github.contributors("openfeign", "feign");

  System.out.println(contributors.getJSONObject(0).getString("login"));
</pre>
json/src/main/java/feign/json/JsonDecoder.java