alibaba / alibaba/fastjson2

[bug]JSONPath.eval取不到值

Open
#2,387 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
4.4k
Forks
613
Avg merge
1d 22h
Merged PRs (30d)
6

Description

Migrating bug from https://github.com/alibaba/fastjson/issues/4493 as fix need to be made here.
Original issue is from [Ryoui](https://github.com/Ryoui)
`public static void main(String[] args) { String data = "{\"userName\":\"zhangsan\"}"; Object userName1 = JSONPath.read(data, "$.userName"); Object userName2 = JSONPath.eval(data, "$.userName"); System.out.println(userName1); System.out.println(userName2); }`
上述代码,在1.2.83版本输出:
zhangsan
zhangsan
在2.0.47输出
zhangsan
null

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the provided JSONPath.read and JSONPath.eval example against fastjson2 2.0.47, then inspect the JSONPath implementation and compare its behavior with fastjson 1.2.83. Done means JSONPath.eval(data, "$.userName") returns "zhangsan" rather than null for the reported input.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.