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
JSON.toJSON(x) should be equivalent to JSON.parse(JSON.toJSONString(x)). But JSON.toJSON does not include the type key when using @JsonType(typeKey = "type").
环境信息
版本信息: Fastjson2 2.0.53
重现步骤
如何操作可以重现该问题:
git clone https://github.com/blutorange/issue-repro
cd issue-repro
git checkout issue-fastjson-tojson-missing-type-key
mvn test
The test fails:
org.opentest4j.AssertionFailedError:
Expected :{"type":"circle","radius":5}
Actual :{"radius":5}
问题描述
JSON.toJSON(x)
should be equivalent toJSON.parse(JSON.toJSONString(x))
. ButJSON.toJSON
does not include the type key when using@JsonType(typeKey = "type")
.环境信息
重现步骤
如何操作可以重现该问题:
The test fails:
For reference, the classes are:
and the test is
期待的正确结果
The
JSONObject
returned byJSON.toJSON
should include"type":"circle"
.The text was updated successfully, but these errors were encountered: