Package dev.runabout

Interface JsonObject


  • public interface JsonObject
    A lightweight interface for dealing with JSON objects.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      JsonObject put​(java.lang.String key, JsonObject value)
      Puts a JSON object value into the JSON object.
      JsonObject put​(java.lang.String key, java.lang.Boolean value)
      Puts a boolean value into the JSON object.
      <T> JsonObject put​(java.lang.String key, java.lang.Class<T> clazz, java.util.List<T> values)
      Puts a list of values into the JSON object.
      JsonObject put​(java.lang.String key, java.lang.Number value)
      Puts a number value into the JSON object.
      JsonObject put​(java.lang.String key, java.lang.String value)
      Puts a string value into the JSON object.
      java.lang.String toJson()
      Converts the JSON object to a JSON string.
    • Method Detail

      • put

        JsonObject put​(java.lang.String key,
                       java.lang.Boolean value)
        Puts a boolean value into the JSON object.
        Parameters:
        key - the key to associate with the value.
        value - the value to put into the JSON object.
        Returns:
        the original JSON object.
      • put

        JsonObject put​(java.lang.String key,
                       java.lang.Number value)
        Puts a number value into the JSON object.
        Parameters:
        key - the key to associate with the value.
        value - the value to put into the JSON object.
        Returns:
        the original JSON object.
      • put

        JsonObject put​(java.lang.String key,
                       java.lang.String value)
        Puts a string value into the JSON object.
        Parameters:
        key - the key to associate with the value.
        value - the value to put into the JSON object.
        Returns:
        the original JSON object.
      • put

        JsonObject put​(java.lang.String key,
                       JsonObject value)
        Puts a JSON object value into the JSON object.
        Parameters:
        key - the key to associate with the value.
        value - the value to put into the JSON object.
        Returns:
        the original JSON object.
      • put

        <T> JsonObject put​(java.lang.String key,
                           java.lang.Class<T> clazz,
                           java.util.List<T> values)
        Puts a list of values into the JSON object.
        Type Parameters:
        T - the type of the values.
        Parameters:
        key - the key to associate with the value.
        clazz - the class of the values.
        values - the values to put into the JSON object.
        Returns:
        the original JSON object.
      • toJson

        java.lang.String toJson()
        Converts the JSON object to a JSON string.
        Returns:
        the JSON string.