Class ObjectToJsonExtensions


  • public final class ObjectToJsonExtensions
    extends java.lang.Object
    The class ObjectToJsonExtensions converts java objects to json string objects.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> java.lang.String toJson​(java.util.List<T> list)
      Creates from the given List a json string
      static <T> java.lang.String toJson​(java.util.List<T> list, com.google.gson.Gson gson)
      Creates from the given List a json string
      static <T> java.lang.String toJson​(T object)
      Creates a json String from the given argument object
      static <T> java.lang.String toJson​(T object, com.google.gson.Gson gson)
      Creates a json String from the given argument object
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • toJson

        public static <T> java.lang.String toJson​(java.util.List<T> list)
        Creates from the given List a json string
        Type Parameters:
        T - the generic type
        Parameters:
        list - the list to transform
        Returns:
        the json string
      • toJson

        public static <T> java.lang.String toJson​(java.util.List<T> list,
                                                  com.google.gson.Gson gson)
        Creates from the given List a json string
        Type Parameters:
        T - the generic type
        Parameters:
        list - the list to transform
        gson - the gson object
        Returns:
        the json string
      • toJson

        public static <T> java.lang.String toJson​(T object)
        Creates a json String from the given argument object
        Type Parameters:
        T - the generic type of the given argument object
        Parameters:
        object - the object to transform
        Returns:
        the json string
      • toJson

        public static <T> java.lang.String toJson​(T object,
                                                  com.google.gson.Gson gson)
        Creates a json String from the given argument object
        Type Parameters:
        T - the generic type of the given argument object
        Parameters:
        object - the object to transform
        gson - the gson object
        Returns:
        the json string