title: Unable to read application/json message in Response output
body: <p>I'm testing REST API and while I make GET call to retrieve resources, it's resulting into 500 Internal Server Error and in output it's returning message which has media type <code>application/json</code>:</p>
  
  <pre><code>[
    {
      "messageType": "Some error type",
      "messageText": "Some message text",
      "moreInfo": "Some info"
    }
  ]
  </code></pre>
  
  <p><strong>Please make note that in above output, Json is inside <code>[]</code></strong></p>
  
  <p>I want to read value of <code>messageText</code> from above output response. I tried with -</p>
  
  <pre><code>JsonObject jsonObject = response.readEntity(JsonObject.class);
  </code></pre>
  
  <p>but it results in following error:</p>
  
  <pre><code>java.lang.IllegalStateException: Entity input stream has already been closed.
      at org.glassfish.jersey.message.internal.EntityInputStream.ensureNotClosed(EntityInputStream.java:225)
      at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:830)
      at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:783)
      at org.glassfish.jersey.client.ClientResponse.readEntity(ClientResponse.java:326)
      at org.glassfish.jersey.client.InboundJaxrsResponse$1.call(InboundJaxrsResponse.java:111)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:228)
      at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:399)
      at org.glassfish.jersey.client.InboundJaxrsResponse.readEntity(InboundJaxrsResponse.java:108)
  </code></pre>
  
  <p>Could you please help me how can I read the message in output? I'm using Jersy library.</p>