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
com.alibaba.fastjson.JSONException: toJSONString error
at com.alibaba.fastjson.JSON.toJSONString(JSON.java:1527)
at com.bulain.fastjson.FastjsonTest.dynPageToJSONString(FastjsonTest.java:60)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
Caused by: java.lang.NullPointerException: Cannot read field "child1" because "this.path" is null
at com.alibaba.fastjson2.JSONWriter.setPath(JSONWriter.java:189)
at com.alibaba.fastjson2.JSONWriter.writeReference(JSONWriter.java:172)
at com.alibaba.fastjson2.writer.FieldWriterList.writeListValue(FieldWriterList.java:219)
at com.alibaba.fastjson2.writer.OWG_1_1_DynPage.write(Unknown Source)
at com.alibaba.fastjson.JSON.toJSONString(JSON.java:1519)
... 4 more
附加信息
如果你还有其他需要提供的信息,可以在这里填写(可以提供截图、视频等)。
The text was updated successfully, but these errors were encountered:
问题描述
将java对象序列化为json字符串时报错,fastjson 1.2.83运行正常,fastjson2 2.0.50运行报错
环境信息
请填写以下信息:
重现步骤
如何操作可以重现该问题:
JSON.toJSONString()
方法test.json
数据com.alibaba.fastjson.JSONException: toJSONString error
错误期待的正确结果
能够正确的序列化java对象为json字符串
相关日志输出
请复制并粘贴任何相关的日志输出。
附加信息
如果你还有其他需要提供的信息,可以在这里填写(可以提供截图、视频等)。
The text was updated successfully, but these errors were encountered: