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
      void put​(java.lang.String key, JsonObject value)
      Puts a JSON object value into the JSON object.
      void put​(java.lang.String key, java.lang.Boolean value)
      Puts a boolean value into the JSON object.
      <T> void put​(java.lang.String key, java.lang.Class<T> clazz, java.util.List<T> values)
      Puts a list of values into the JSON object.
      void put​(java.lang.String key, java.lang.Number value)
      Puts a number value into the JSON object.
      void 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

        void 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.
      • put

        void 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.
      • put

        void 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.
      • put

        void 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.
      • put

        <T> void 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.
      • toJson

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