Skip to content

Instantly share code, notes, and snippets.

@RealDeanZhao
Created April 10, 2017 06:00
Show Gist options
  • Save RealDeanZhao/af5ef2d1d6eb98729103cc16028e177f to your computer and use it in GitHub Desktop.
Save RealDeanZhao/af5ef2d1d6eb98729103cc16028e177f to your computer and use it in GitHub Desktop.
Parse InputStream to JsonObject
JsonObject json;
  try {
    JsonElement element = new JsonParser().parse(
    new InputStreamReader(responseEntity.getBody().getInputStream())
  );
  json = element.getAsJsonObject();
} catch (IOException e) {
  throw new RuntimeException(e.getLocalizedMessage());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment