public final class InternalJSONUtil extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
static String |
escape(String str)
转义显示不可见字符
|
static <T> JSONDeserializer<T> |
getDeserializer(Type targetType)
根据目标类型,获取对应的
JSONDeserializer,首先判断是否实现了JSONDeserializer接口如果未实现从 GlobalSerializeMapping中查找全局的JSONDeserializer,否则返回null |
static <T> JSONValueWriter<T> |
getValueWriter(T value)
根据值类型获取
JSONValueWriter,首先判断对象是否实现了JSONValueWriter接口如果未实现从 GlobalValueWriterMapping中查找全局的writer,否则返回null。 |
static void |
propertyPut(JSONObject jsonObject,
Object key,
Object value,
Predicate<MutableEntry<String,Object>> predicate)
将Property的键转化为JSON形式
用于识别类似于:org.dromara.hutool.json这类用点隔开的键 注意:不允许重复键 |
static String |
quote(String string)
对所有双引号做转义处理(使用双反斜杠做转义)
为了能在HTML中较好的显示,会将</转义为<\/ JSON字符串中不能包含控制字符和未经转义的引号和反斜杠 |
static String |
quote(String string,
boolean isWrap)
对所有双引号做转义处理(使用双反斜杠做转义)
为了能在HTML中较好的显示,会将</转义为<\/ JSON字符串中不能包含控制字符和未经转义的引号和反斜杠 |
static void |
quote(String str,
Writer writer)
对所有双引号做转义处理(使用双反斜杠做转义)
为了能在HTML中较好的显示,会将</转义为<\/ JSON字符串中不能包含控制字符和未经转义的引号和反斜杠 |
static Writer |
quote(String str,
Writer writer,
boolean isWrap)
对所有双引号做转义处理(使用双反斜杠做转义)
为了能在HTML中较好的显示,会将</转义为<\/ JSON字符串中不能包含控制字符和未经转义的引号和反斜杠 |
static CopyOptions |
toCopyOptions(JSONConfig config)
将
JSONConfig参数转换为Bean拷贝所用的CopyOptions |
public static void propertyPut(JSONObject jsonObject, Object key, Object value, Predicate<MutableEntry<String,Object>> predicate)
jsonObject - JSONObjectkey - 键value - 值predicate - 属性过滤器,Predicate.test(Object)为true保留public static CopyOptions toCopyOptions(JSONConfig config)
JSONConfig参数转换为Bean拷贝所用的CopyOptionsconfig - JSONConfigCopyOptionspublic static String quote(String string)
string - 字符串public static String quote(String string, boolean isWrap)
string - 字符串isWrap - 是否使用双引号包装字符串public static void quote(String str, Writer writer) throws IORuntimeException
str - 字符串writer - WriterIORuntimeException - IO异常public static Writer quote(String str, Writer writer, boolean isWrap) throws IORuntimeException
str - 字符串writer - WriterisWrap - 是否使用双引号包装字符串IORuntimeException - IO异常public static <T> JSONValueWriter<T> getValueWriter(T value)
JSONValueWriter,首先判断对象是否实现了JSONValueWriter接口GlobalValueWriterMapping中查找全局的writer,否则返回null。T - 值类型value - 值JSONValueWriterpublic static <T> JSONDeserializer<T> getDeserializer(Type targetType)
JSONDeserializer,首先判断是否实现了JSONDeserializer接口GlobalSerializeMapping中查找全局的JSONDeserializer,否则返回nullT - 目标类型targetType - 目标类型JSONDeserializerCopyright © 2023. All rights reserved.