mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
support alias annotation
This commit is contained in:
@@ -55,13 +55,13 @@ final class InternalJSONUtil {
|
||||
} else if (value instanceof Boolean) {
|
||||
writer.write(value.toString());
|
||||
} else if (value instanceof JSONString) {
|
||||
Object o;
|
||||
String valueStr;
|
||||
try {
|
||||
o = ((JSONString) value).toJSONString();
|
||||
valueStr = ((JSONString) value).toJSONString();
|
||||
} catch (Exception e) {
|
||||
throw new JSONException(e);
|
||||
}
|
||||
writer.write(o != null ? o.toString() : JSONUtil.quote(value.toString()));
|
||||
writer.write(valueStr != null ? valueStr : JSONUtil.quote(value.toString()));
|
||||
} else {
|
||||
JSONUtil.quote(value.toString(), writer);
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@ public class CustomSerializeTest {
|
||||
JSONObject obj = JSONUtil.parseObj(customBean);
|
||||
Assert.assertEquals("testName", obj.getStr("customName"));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void deserializeTest() {
|
||||
JSONUtil.putDeserializer(CustomBean.class, json -> {
|
||||
|
Reference in New Issue
Block a user