Package org.aoju.bus.extra.json
Interface JsonProvider
- All Known Implementing Classes:
AbstractJsonProvider,FastJsonProvider,GsonProvider,JacksonProvider
public interface JsonProvider
JSON服务提供者
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Method Summary
Modifier and TypeMethodDescription<T> T获取json字符串指定属性值boolean判断是否为标准jsontoJsonString(Object object) 解析对象为Json字符串toJsonString(Object object, String format) 解析对象为Json字符串<T> List<T>解析json字符串到List<T> List<T>按指定的Type解析json字符串到List<T> List<T>按指定的Type解析json字符串到List<K,V> Map<K, V> 转换对象到Map<K,V> Map<K, V> 解析json字符串到Map<T> T解析json字符串到指定类型的对象<T> T从Map转换到对象
-
Method Details
-
toJsonString
解析对象为Json字符串- Parameters:
object- 要转换的对象- Returns:
- 返回对象的json字符串
-
toJsonString
解析对象为Json字符串- Parameters:
object- 要转换的对象format- 日期格式,如"yyyy年MM月dd日 HH时mm分ss秒"- Returns:
- 返回对象的json字符串
-
toPojo
解析json字符串到指定类型的对象- Type Parameters:
T- 泛型参数类型- Parameters:
json- 要解析的json字符串clazz- 类对象class- Returns:
- 返回解析后的对象
-
toPojo
从Map转换到对象- Type Parameters:
T- 泛型参数类型- Parameters:
map- Map对象clazz- 与Map可兼容的对象类型- Returns:
- 返回Map转换得到的对象
-
toList
解析json字符串到List- Type Parameters:
T- 泛型参数类型- Parameters:
json- 要解析的json字符串- Returns:
- 返回List
-
toList
按指定的Type解析json字符串到List- Type Parameters:
T- 泛型参数类型- Parameters:
json- 要解析的json字符串clazz- 类对象class- Returns:
- 返回List
-
toList
按指定的Type解析json字符串到List- Type Parameters:
T- 泛型参数类型- Parameters:
json- 要解析的json字符串type-Type- Returns:
- 返回List
-
toMap
解析json字符串到Map- Type Parameters:
K- 键类型V- 值类型- Parameters:
json- 要解析的json字符串- Returns:
- 返回Map
-
toMap
转换对象到Map- Type Parameters:
K- 键类型V- 值类型- Parameters:
object- 与Map可兼容的对象- Returns:
- 返回Map对象
-
getValue
获取json字符串指定属性值- Type Parameters:
T- 泛型参数类型- Parameters:
json- 要解析的json字符串field- 属性名称- Returns:
- 返回解析后的属性值
-
isJson
判断是否为标准json- Parameters:
json- 字符串- Returns:
- the true/false
-