alibaba / fastjson

FASTJSON 2.0.x has been released, faster and more secure, recommend you upgrade.
https://github.com/alibaba/fastjson2/wiki/fastjson_1_upgrade_cn
Apache License 2.0
25.75k stars 6.5k forks source link

fastjson2 2.0.16版本及以上报Cannot read field "child0" because "this.path" is null错误 #4344

Closed creky closed 1 year ago

creky commented 1 year ago

java.lang.NullPointerException: Cannot read field "child0" because "this.path" is null at com.alibaba.fastjson2.JSONWriter.setPath(JSONWriter.java:194) at com.alibaba.fastjson2.writer.ObjectWriterImplList.write(ObjectWriterImplList.java:365) at com.alibaba.fastjson.JSON.toJSONStringWithDateFormat(JSON.java:1760) at com.jfinal.json.FastJson.toJson(FastJson.java:55) 经查原因是com.alibaba.fastjson2.JSONWriter#JSONWriter构造函数没有设置默认的path值。在里面设置个: path = JSONWriter.Path.ROOT; 就可以了?

wenshao commented 1 year ago

https://github.com/alibaba/fastjson2/issues 可以到这里提issue么?

creky commented 1 year ago

经查原因是com.alibaba.fastjson2.JSONWriter#JSONWriter构造函数没有设置默认的path值。在里面设置个: path = JSONWriter.Path.ROOT; 就可以了?

已在那边提交