Interface JsonObject

All Superinterfaces:
JsonNode

public interface JsonObject extends JsonNode
Interface that represents a JSON object.
  • Method Details

    • isObject

      default boolean isObject()
      Specified by:
      isObject in interface JsonNode
      Returns:
      True if this JsonNode is an instance of JsonObject.
    • fields

      Returns:
      Stream for all fields in the object.
    • fieldNames

      Stream<String> fieldNames()
      Returns:
      Stream for all field names in the object.
    • get

      JsonNode get(String name)
      Gets the JsonNode field with the specified name in the object.
      Parameters:
      name - Name of the node.
      Returns:
      JsonNode for the specified field in the object if it exist, null otherwise.
    • has

      boolean has(String name)
      Returns whether the object has a value for the specified field.
      Parameters:
      name - Name of the node.
      Returns:
      Whether the object has a value for the specified field.
    • put

      JsonObject put(String name, JsonNode jsonNode)
      Puts a JsonNode field with the specified name into the object.
      Parameters:
      name - Name of the node.
      jsonNode - The JsonNode to put into the object.
      Returns:
      The update JsonObject object.
    • remove

      JsonNode remove(String name)
      Removes the JsonNode with the specified name from the object.
      Parameters:
      name - Name of the node.
      Returns:
      JsonNode removed from the object if it existed, null otherwise.
    • set

      JsonNode set(String name, JsonNode jsonNode)
      Sets the JsonNode field with the specified name with a new node value.
      Parameters:
      name - Name of the node.
      jsonNode - The new JsonNode value.
      Returns:
      The old JsonNode value if it was set, null otherwise.