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;
就可以了?
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;
就可以了?