-
Notifications
You must be signed in to change notification settings - Fork 495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
jsonpath not support integer key #842
Comments
从fastjson1 升级到fastjson2 发现好多jsonpath 不兼容问题 !数字key在tostring的时候也会报错类型转换错误,貌似底层fastjson2 认为json的key只能是字符串 |
还有要支持宽松的 解析模式 很多json都是手写的 不想严格按照json格式来 |
String str = "{\"items\": [{\"data\":{\"0\":\"abc\"}}]}";
Object result = JSONPath.eval(str, "$.items[0].data.0");
assertEquals("abc", result); 这个是不是你想要的? |
设置不进去 我的是fastjson-2.0.15 |
https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.16-SNAPSHOT/ |
会打印: 我希望是打印 {"obj":{5:"设置成功"}} obj是对象 不是数组 我用的最新的2.0.16 |
Map data = new LinkedHashMap<>(); 我希望是打印 {"obj":{5:"设置成功"}} obj是对象 不是数组 我用的最新的2.0.17 |
以前的fastjson1 就是支持数字key的 或者说是字符串为数字的 如key 为"12345" |
$.items[0].data.\0\
\0\ is data Object
0是data对象的键 data是个对象 不是数组
The text was updated successfully, but these errors were encountered: