public final class InternalJSONUtil extends Object
| Constructor and Description |
|---|
InternalJSONUtil() |
| Modifier and Type | Method and Description |
|---|---|
static String |
escape(String str)
转义显示不可见字符
|
static <T> JSONDeserializer<T> |
getDeserializer(Type targetType)
根据目标类型,获取对应的
JSONDeserializer,首先判断是否实现了JSONDeserializer接口如果未实现从 GlobalSerializeMapping中查找全局的JSONDeserializer,否则返回null |
static Object |
parseValueFromString(String string)
尝试转换字符串为number, boolean, or null,无法转换返回String
此方法用于解析JSON字符串时,将字符串中的值转换为JSON值对象 |
static void |
propertyPut(JSONObject jsonObject,
Object key,
Object value,
Predicate<MutableEntry<String,Object>> predicate)
将Property的键转化为JSON形式
用于识别类似于:org.dromara.hutool.json这类用点隔开的键 注意:不允许重复键 |
static String |
quote(CharSequence string)
对所有双引号做转义处理(使用双反斜杠做转义)
为了能在HTML中较好的显示,会将</转义为<\/ JSON字符串中不能包含控制字符和未经转义的引号和反斜杠 |
static String |
quote(CharSequence string,
boolean isWrap)
对所有双引号做转义处理(使用双反斜杠做转义)
为了能在HTML中较好的显示,会将</转义为<\/ JSON字符串中不能包含控制字符和未经转义的引号和反斜杠 |
static void |
quote(CharSequence str,
Writer writer)
对所有双引号做转义处理(使用双反斜杠做转义)
为了能在HTML中较好的显示,会将</转义为<\/ JSON字符串中不能包含控制字符和未经转义的引号和反斜杠 |
static Writer |
quote(CharSequence str,
Writer writer,
boolean isWrap)
对所有双引号做转义处理(使用双反斜杠做转义)
为了能在HTML中较好的显示,会将</转义为<\/ JSON字符串中不能包含控制字符和未经转义的引号和反斜杠 |
static CopyOptions |
toCopyOptions(JSONConfig config)
将
JSONConfig参数转换为Bean拷贝所用的CopyOptions |
public static Object parseValueFromString(String string)
string - A String.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(CharSequence string)
string - 字符串public static String quote(CharSequence string, boolean isWrap)
string - 字符串isWrap - 是否使用双引号包装字符串public static void quote(CharSequence str, Writer writer) throws IORuntimeException
str - 字符串writer - WriterIORuntimeException - IO异常public static Writer quote(CharSequence str, Writer writer, boolean isWrap) throws IORuntimeException
str - 字符串writer - WriterisWrap - 是否使用双引号包装字符串IORuntimeException - IO异常public static <T> JSONDeserializer<T> getDeserializer(Type targetType)
JSONDeserializer,首先判断是否实现了JSONDeserializer接口GlobalSerializeMapping中查找全局的JSONDeserializer,否则返回nullT - 目标类型targetType - 目标类型JSONDeserializerCopyright © 2024. All rights reserved.