Interface JsonNull

All Superinterfaces:
JsonValue

public non-sealed interface JsonNull extends JsonValue
The interface that represents JSON null.

A JsonNull can be created by parsing JSON text using either Json.parse(String) or Json.parse(char[]).

Alternatively, of() can be used to obtain a JsonNull.

Since:
28
  • Method Summary

    Static Methods
    Modifier and Type
    Method
    Description
    static JsonNull
    of()
    Returns a JsonNull.

    Methods declared in interface JsonValue

    asBoolean, asDouble, asInt, asList, asLong, asMap, asString, get, get, toString, tryGet, tryValue
    Modifier and Type
    Method
    Description
    default boolean
    Returns the boolean value represented by this JsonValue if it is an instance of JsonBoolean; otherwise, throws a JsonValueException.
    default double
    Returns a double if this JsonValue is an instance of JsonNumber that can be converted, as if by Double.parseDouble, to a finite double value; otherwise, throws a JsonValueException.
    default int
    Returns an int if this JsonValue is an instance of JsonNumber that can be converted exactly; otherwise, throws a JsonValueException.
    default List<JsonValue>
    Returns an unmodifiable list of the JsonValues if this JsonValue is an instance of JsonArray; otherwise, throws a JsonValueException.
    default long
    Returns a long if this JsonValue is an instance of JsonNumber that can be converted exactly; otherwise, throws a JsonValueException.
    default Map<String, JsonValue>
    Returns an unmodifiable map of String to JsonValue if this JsonValue is an instance of JsonObject; otherwise, throws a JsonValueException.
    default String
    Returns the String value represented by this JsonValue if it is an instance of JsonString; otherwise, throws a JsonValueException.
    default JsonValue
    get(int index)
    Returns the JsonValue associated with the given index if this JsonValue is an instance of JsonArray; otherwise, throws a JsonValueException.
    default JsonValue
    get(String name)
    Returns the JsonValue associated with the given member name if this JsonValue is an instance of JsonObject; otherwise, throws a JsonValueException.
    Returns a String representation of this JsonValue that conforms to JSON syntax.
    tryGet(String name)
    Returns an Optional containing the value of a given member of this JsonObject, or an empty Optional if the member is absent; throws JsonValueException if this JsonValue is not a JsonObject.
    Returns an Optional containing this JsonValue if it is not an instance of JsonNull, otherwise an empty Optional.
  • Method Details

    • of

      static JsonNull of()
      Returns a JsonNull.
      Returns:
      a JsonNull