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
请复制并粘贴任何相关的日志输出。
//testJsonOffsetFail
com.alibaba.fastjson2.JSONException: not allow unquoted fieldName, offset 30, character �, line 1, column 31, fastjson-version 2.0.21 {//一段注释
"name": "www"}
at com.alibaba.fastjson2.JSONReader.read(JSONReader.java:1477)
at com.alibaba.fastjson2.JSON.parseObject(JSON.java:254)
at fileLoad.SimpleTest.testJsonOffsetFail(SimpleTest.java:12)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:220)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:53)
//testJsonOffsetSucccess
{"name":"www"}
附加信息
如果你还有其他需要提供的信息,可以在这里填写(可以提供截图、视频等)。
The text was updated successfully, but these errors were encountered:
问题描述
简要描述您碰到的问题。
当json字符串中存在注释时,如果使用JSON.parseObject(str)可以正确处理。
如果使用JSON.parseObject(str,offset,length)可能无法正确处理。
环境信息
请填写以下信息:
重现步骤
如何操作可以重现该问题:
xxx.xxx
方法...
数据...
错误期待的正确结果
对您期望发生的结果进行清晰简洁的描述。
当从字符串中截取一部分作为格式化json时,能够正确解析注释部分
相关日志输出
请复制并粘贴任何相关的日志输出。
//testJsonOffsetFail
com.alibaba.fastjson2.JSONException: not allow unquoted fieldName, offset 30, character �, line 1, column 31, fastjson-version 2.0.21 {//一段注释
"name": "www"}
//testJsonOffsetSucccess
{"name":"www"}
附加信息
如果你还有其他需要提供的信息,可以在这里填写(可以提供截图、视频等)。
The text was updated successfully, but these errors were encountered: