You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import com.alibaba.fastjson2.annotation.JSONField;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class Bean {
@JSONField(name = "e")
private String event;
@JSONField(name = "E")
private Long et;
}
json string反序列化为Bean正常,
JSONObject.parseObject(m, Bean.class);
将Bean.java改成SimpleBean.java
import com.alibaba.fastjson2.annotation.JSONField;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class SimpleBean {
// @JSONField(name = "e")
// private String event;
@JSONField(name = "E")
private Long et;
}
json string反序列化为SimpleBean
JSONObject.parseObject(m, SimpleBean.class);
抛异常:
com.alibaba.fastjson2.JSONException: parseLong error, value : event
at com.alibaba.fastjson2.JSONReader.toInt64(JSONReader.java:2535)
at com.alibaba.fastjson2.JSONReader.getInt64(JSONReader.java:656)
at com.alibaba.fastjson2.JSONReaderUTF8.readInt64(JSONReaderUTF8.java:2266)
at com.alibaba.fastjson2.reader.ORG_1_2_UMOrderUpdate.readObject(Unknown Source)
at com.alibaba.fastjson2.JSON.parseObject(JSON.java:642)
at com.alibaba.fastjson2.JSONObject.parseObject(JSONObject.java:1942)
环境信息
OS信息: Win10 Home
JDK信息: corretto-17.0.6
版本信息:Fastjson2 2.0.26
重现步骤
见问题描述
期待的正确结果
json能够正常反序列化
相关日志输出
见问题描述
附加信息
无
The text was updated successfully, but these errors were encountered:
问题描述
json string: {"e":"event", "E":1568879465651}
构造Bean.java
json string反序列化为Bean正常,
将Bean.java改成SimpleBean.java
json string反序列化为SimpleBean
抛异常:
环境信息
重现步骤
见问题描述
期待的正确结果
json能够正常反序列化
相关日志输出
见问题描述
附加信息
无
The text was updated successfully, but these errors were encountered: