Skip to content
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

[FEATURE] 感谢添加对JSONPath解析指定index值判断的支持,以下是我对JSONPath唯一的愿景 #2405

Closed
SMFDrummer opened this issue Apr 6, 2024 · 2 comments
Labels
enhancement New feature or request fixed
Milestone

Comments

@SMFDrummer
Copy link

以下是JSON数据

{
 "version": 1,
 "objects": [
  {
   "objclass": "SunflowerProps",
   "aliases": [
    "TwinSunflowerDefault"
   ],
   "objdata": {
    "PlantFoodActivationSound": "Play_Plant_TwinSunflower_Nitro",
    "CollectibleTypeName": "sun",
    "Actions": [
     {
      "Type": "sun",
      "SpawnOffset": {
       "x": -10,
       "y": -55
      }
     }
    ]
   }
  }
 ]
}

我的愿景是可以判断Type为sun的所有PlantFoodActivationSound属性值,其中objects、Actions含有多项。

正确的JSONPath为:$.objects[?(@.objdata.Actions[?(@.Type == 'sun')])].objdata.PlantFoodActivationSound

正确的结果为:["Play_Plant_TwinSunflower_Nitro"]

目前没有任何包含JSONPath解析的库可以解析复合判断的表达式,包括吹上天的Snack3,但是有一个极为离谱的东西支持

Intellij Idea JSONPath Extension
jp

请注意,这只是我对JSONPath的愿景,截图只为证明我的JSONPath没有语法问题(就普遍规范来讲),请阿里开发者不要为这个东西过渡操劳,感谢您的付出!

@SMFDrummer SMFDrummer added the enhancement New feature or request label Apr 6, 2024
@wenshao wenshao added this to the 2.0.49 milestone Apr 6, 2024
@wenshao
Copy link
Member

wenshao commented Apr 6, 2024

https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.49-SNAPSHOT/
问题已经修复,请帮忙用2.0.49-SNAPSHOT版本验证,2.0.49版本预计在4月底发布

@wenshao wenshao added the fixed label Apr 6, 2024
@wenshao
Copy link
Member

wenshao commented Apr 14, 2024

https://github.com/alibaba/fastjson2/releases/tag/2.0.49
问题已修复,请用新版本

@wenshao wenshao closed this as completed Apr 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fixed
Projects
None yet
Development

No branches or pull requests

2 participants