Interface JsonNode

    • Method Detail

      • emptyObjectNode

        static JsonNode emptyObjectNode()
        Return an empty object node.
      • isNumber

        default boolean isNumber()
        Returns true if this node represents a JSON number: https://datatracker.ietf.org/doc/html/rfc8259#section-6
        See Also:
        asNumber()
      • isString

        default boolean isString()
        Returns true if this node represents a JSON string: https://datatracker.ietf.org/doc/html/rfc8259#section-7
        See Also:
        asString()
      • isBoolean

        default boolean isBoolean()
        Returns true if this node represents a JSON boolean: https://datatracker.ietf.org/doc/html/rfc8259#section-3
        See Also:
        asBoolean()
      • isNull

        default boolean isNull()
        Returns true if this node represents a JSON null: https://datatracker.ietf.org/doc/html/rfc8259#section-3
      • isArray

        default boolean isArray()
        Returns true if this node represents a JSON array: https://datatracker.ietf.org/doc/html/rfc8259#section-5
        See Also:
        asArray()
      • isObject

        default boolean isObject()
        Returns true if this node represents a JSON object: https://datatracker.ietf.org/doc/html/rfc8259#section-4
        See Also:
        asObject()
      • isEmbeddedObject

        default boolean isEmbeddedObject()
        Returns true if this node represents a JSON "embedded object". This non-standard type is associated with JSON extensions, like CBOR or ION. It allows additional data types to be embedded in a JSON document, like a timestamp or a raw byte array.

        Users who are only concerned with handling JSON can ignore this field. It will only be present when using a custom JsonFactory via JsonNodeParser.Builder.jsonFactory(JsonFactory).

        See Also:
        asEmbeddedObject()
      • asNumber

        String asNumber()
        When isNumber() is true, this returns the number associated with this node. This will throw an exception if isNumber() is false.
        See Also:
        text()
      • asString

        String asString()
        When isString(), is true, this returns the string associated with this node. This will throw an exception if isString() ()} is false.
      • asBoolean

        boolean asBoolean()
        When isBoolean() is true, this returns the boolean associated with this node. This will throw an exception if isBoolean() is false.
      • asArray

        List<JsonNode> asArray()
        When isArray() is true, this returns the array associated with this node. This will throw an exception if isArray() is false.
      • visit

        <T> T visit​(JsonNodeVisitor<T> visitor)
        Visit this node using the provided visitor.
      • text

        String text()
        When isString(), isBoolean(), or isNumber() is true, this will return the value of this node as a textual string. If this is any other type, this will return null.
      • index

        default Optional<JsonNode> index​(int child)
        When isArray() is true, this will return the result of asArray().get(child) if child is within bounds. If this is any other type or the child is out of bounds, this will return Optional.empty().