code: public static String toJson(Object object, boolean pretty)
      {
          if (object == null)
          {
              return null;
          }
  
          if (pretty)
          {
              return PRETTY_GSON.toJson(object);
          }
          else
          {
              return GSON.toJson(object);
          }
      }
docs: Convert the given object into a JSON string using
  <a href="https://github.com/google/gson">Gson</a>.
  
  @param object
  The input object.
  
  @param pretty
  True for human-readable format.
  
  @return
  A JSON string. If {@code object} is {@code null},
  {@code null} is returned.
  
  @since 2.0