类 JsonUtils

java.lang.Object
com.hengyi.xbaseweb.common.utils.JsonUtils

public class JsonUtils extends Object
  • 构造器详细资料

    • JsonUtils

      public JsonUtils()
  • 方法详细资料

    • toString

      public static String toString(Object obj)
      转为字符串
      参数:
      obj -
      返回:
    • toJsonObject

      public static com.alibaba.fastjson2.JSONObject toJsonObject(String obj)
      转换为JsonObject
      参数:
      obj -
      返回:
    • toBean

      public static <T> T toBean(String text, Class<T> clazz)
      转换为对象
      类型参数:
      T -
      参数:
      text -
      clazz -
      返回:
    • toBean

      public static <T> T toBean(String text, com.alibaba.fastjson2.TypeReference<T> type)
      转换为对象
      类型参数:
      T -
      参数:
      text -
      type -
      返回:
    • toArray

      public static <T> Object[] toArray(String text)
      转换为数组
      类型参数:
      T -
      参数:
      text -
      返回:
    • toArray

      public static <T> Object[] toArray(String text, Class<T> clazz)
      转换为数组
      类型参数:
      T -
      参数:
      text -
      clazz -
      返回:
    • toList

      public static <T> List<T> toList(String text, Class<T> clazz)
      转换为List
      类型参数:
      T -
      参数:
      text -
      clazz -
      返回:
    • isJsonObject

      public static Boolean isJsonObject(String text)
      判断字符串是否为json对象
      参数:
      text -
      返回:
    • isJsonArray

      public static Boolean isJsonArray(String text)
      判断字符串是否为json数组
      参数:
      text -
      返回: