程序包 cn.zhxu.xjson

类 JsonKit

java.lang.Object
cn.zhxu.xjson.JsonKit

public class JsonKit extends Object
从以下版本开始:
1.0.0 JSON 工具类,不依赖具体实现
作者:
Troy.Zhou
  • 构造器概要

    构造器
    构造器
    说明
     
  • 方法概要

    修饰符和类型
    方法
    说明
    static cn.zhxu.data.Array
    toArray(byte[] jsonBytes)
    JSON 字节数组转换为 Array 对象
    static cn.zhxu.data.Array
    JSON 字符串转换为 Array 对象
    static <T> T
    toBean(cn.zhxu.data.TypeRef<T> typeRef, byte[] jsonBytes)
    JSON 字节数组转换为 Bean 对象
    static <T> T
    toBean(cn.zhxu.data.TypeRef<T> typeRef, String json)
    JSON 字符串转换为 Bean 对象
    static <T> T
    toBean(Type type, byte[] jsonBytes)
    JSON 字节数组转换为 Bean 对象
    static <T> T
    toBean(Type type, String json)
    JSON 字符串转换为 Bean 对象
    static byte[]
    toBytes(Object object)
    对象转 JSON 字节数组
    static String
    toJson(Object object)
    对象转 JSON 字符串
    static <T> List<T>
    toList(Class<T> type, byte[] jsonBytes)
    JSON 字节数组转换为 Bean 对象
    static <T> List<T>
    toList(Class<T> type, String json)
    JSON 字符串转换为 Bean 对象
    static cn.zhxu.data.Mapper
    toMapper(byte[] jsonBytes)
    JSON 字节数组转换为 Mapper 对象
    static cn.zhxu.data.Mapper
    JSON 字符串转换为 Mapper 对象

    从类继承的方法 java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 构造器详细资料

    • JsonKit

      public JsonKit()
  • 方法详细资料

    • toMapper

      public static cn.zhxu.data.Mapper toMapper(String json)
      JSON 字符串转换为 Mapper 对象
      参数:
      json - JSON 字符串
      返回:
      Mapper
    • toMapper

      public static cn.zhxu.data.Mapper toMapper(byte[] jsonBytes)
      JSON 字节数组转换为 Mapper 对象
      参数:
      jsonBytes - JSON 字节数组
      返回:
      Mapper
      从以下版本开始:
      v1.3.0
    • toArray

      public static cn.zhxu.data.Array toArray(String json)
      JSON 字符串转换为 Array 对象
      参数:
      json - JSON 字符串
      返回:
      Array
    • toArray

      public static cn.zhxu.data.Array toArray(byte[] jsonBytes)
      JSON 字节数组转换为 Array 对象
      参数:
      jsonBytes - JSON 字节数组
      返回:
      Array
      从以下版本开始:
      v1.3.0
    • toBean

      public static <T> T toBean(Type type, String json)
      JSON 字符串转换为 Bean 对象
      类型参数:
      T - 泛型
      参数:
      type - Bean 类型
      json - JSON 字符串
      返回:
      Bean 对象
    • toBean

      public static <T> T toBean(Type type, byte[] jsonBytes)
      JSON 字节数组转换为 Bean 对象
      类型参数:
      T - 泛型
      参数:
      type - Bean 类型
      jsonBytes - JSON 字节数组
      返回:
      Bean 对象
      从以下版本开始:
      v1.3.0
    • toBean

      public static <T> T toBean(cn.zhxu.data.TypeRef<T> typeRef, String json)
      JSON 字符串转换为 Bean 对象
      类型参数:
      T - 泛型
      参数:
      typeRef - Bean 类型
      json - JSON 字符串
      返回:
      Bean 对象
      从以下版本开始:
      v1.2.0
    • toBean

      public static <T> T toBean(cn.zhxu.data.TypeRef<T> typeRef, byte[] jsonBytes)
      JSON 字节数组转换为 Bean 对象
      类型参数:
      T - 泛型
      参数:
      typeRef - Bean 类型
      jsonBytes - JSON 字节数组
      返回:
      Bean 对象
      从以下版本开始:
      v1.2.0
    • toList

      public static <T> List<T> toList(Class<T> type, String json)
      JSON 字符串转换为 Bean 对象
      类型参数:
      T - 泛型
      参数:
      type - Bean 类型
      json - JSON 字符串
      返回:
      Bean List
    • toList

      public static <T> List<T> toList(Class<T> type, byte[] jsonBytes)
      JSON 字节数组转换为 Bean 对象
      类型参数:
      T - 泛型
      参数:
      type - Bean 类型
      jsonBytes - JSON 字节数组
      返回:
      Bean List
      从以下版本开始:
      v1.2.0
    • toJson

      public static String toJson(Object object)
      对象转 JSON 字符串
      参数:
      object - 对象
      返回:
      JSON 字符串
    • toBytes

      public static byte[] toBytes(Object object)
      对象转 JSON 字节数组
      参数:
      object - 对象
      返回:
      JSON 字节数组
      从以下版本开始:
      v1.2.0