Interface JsonObject


public interface JsonObject
Represents a JSON object.
  • Method Details

    • getValue

      <T> T getValue(String name, JsonValueType<T> valueType)
      Retrieves the value of a property with the given name.

      If there is no property with the given name, this throws an exception.

      If the value for the given name is null, this returns null.

      Type Parameters:
      T - the requested value type
      Parameters:
      name - the name of the property. Cannot be null.
      valueType - the requested value type. Cannot be null.
      Returns:
      the value of a property with the given name
    • getProperties

      Map<String,JsonProperty> getProperties()
      Retrieves a Map representing the properties of the JSON object. The keys of the Map are the names of the properties, and the values are JsonProperty objects representing the types of the properties.
      Returns:
      a Map of all properties of the JSON object
    • contains

      boolean contains(String name)
      Determines if the specified property is present on the object.
      Parameters:
      name - the name of the property. Cannot be null.
      Returns:
      true if the property is present on the object; otherwise false
    • asString

      String asString()
      Formats the object as a String.
      Returns:
      the object as a String