Class JacksonResponse.JsonReader

java.lang.Object
com.jcabi.http.response.JacksonResponse.JsonReader
Enclosing class:
JacksonResponse

public static final class JacksonResponse.JsonReader extends Object
A tree representation views of JSON documents.
Since:
1.17.1
  • Constructor Summary

    Constructors
    Constructor
    Description
    JsonReader(byte[] bytes)
    Public constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.fasterxml.jackson.databind.JsonNode
    Returns an immutable JSON node.
    com.fasterxml.jackson.databind.node.ArrayNode
    Returns a mutable JSON array node, if the parsed JSON is a valid array.
    com.fasterxml.jackson.databind.node.ObjectNode
    Returns a mutable JSON object node, if the parsed JSON is a valid object.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • JsonReader

      public JsonReader(byte[] bytes)
      Public constructor.
      Parameters:
      bytes - The HTTP response body as an array of bytes.
  • Method Details

    • readArray

      public com.fasterxml.jackson.databind.node.ArrayNode readArray() throws IOException
      Returns a mutable JSON array node, if the parsed JSON is a valid array.
      Returns:
      JSON array node.
      Throws:
      IOException - If the body is not a valid JSON or JSON array.
    • readObject

      public com.fasterxml.jackson.databind.node.ObjectNode readObject() throws IOException
      Returns a mutable JSON object node, if the parsed JSON is a valid object.
      Returns:
      JSON object node.
      Throws:
      IOException - If the body is not a valid JSON or JSON object.
    • read

      public com.fasterxml.jackson.databind.JsonNode read() throws IOException
      Returns an immutable JSON node.
      Returns:
      JSON node.
      Throws:
      IOException - If the body is not a valid JSON.