-
Notifications
You must be signed in to change notification settings - Fork 479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] 对于LocalTime的支持有问题, 且JSONField无效 #591
Comments
感觉ReaderImpl的实现有点粗糙,这个直接用了默认实现,且没看到源码中什么hook可以注入自己的实现 if (type == LocalTime.class) {
return ObjectReaderImplLocalTime.INSTANCE;
}
static final ObjectReaderImplLocalTime INSTANCE = new ObjectReaderImplLocalTime(null, null); |
临时方案,复制ObjectReaderImplLocalTime,传入相应格式。 try (JSONReader reader = JSONReader.of(testStr)) {
JSONReader.Context context = reader.getContext();
boolean fieldBased = (context.getFeatures() & JSONReader.Feature.FieldBased.mask) != 0;
context.getProvider().registerIfAbsent(LocalTime.class, new ObjectReaderImplLocalTime("HH:mm", null));
ObjectReader<TestAA> objectReader = context.getProvider().getObjectReader(TestAA.class, fieldBased);
TestAA object = objectReader.readObject(reader, null, null, 0);
} |
wenshao
added a commit
that referenced
this issue
Jul 28, 2022
wenshao
added a commit
that referenced
this issue
Jul 28, 2022
https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.11-SNAPSHOT/ |
已验证,thanks |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
问题描述
反序列化JSON有问题,
ObjectReaderImplLocalTime
未正确读取到format环境信息
请填写以下信息:
重现步骤
如何操作可以重现该问题:
期待的正确结果
fix
相关日志输出
The text was updated successfully, but these errors were encountered: