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

[BUG] JSONPath.eval not getting data #2542

Closed
Cooper-Zhong opened this issue May 8, 2024 · 1 comment
Closed

[BUG] JSONPath.eval not getting data #2542

Cooper-Zhong opened this issue May 8, 2024 · 1 comment
Labels
bug Something isn't working fixed
Milestone

Comments

@Cooper-Zhong
Copy link
Contributor

问题描述

Based on #1965, Fastjson JSONPath.eval 为null,与fastjson2不一致

环境信息

  • OS信息: [MacOS 12.7.4 M1 Pro 16 GB]
  • JDK信息: [Openjdk 17.0.6]
  • 版本信息:[Fastjson 2.0.49]

重现步骤

import com.alibaba.fastjson2.JSONPath;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

public class Issue1965_222 {
  
    @Test
    public void test() {
        String temp = "{\n" +
                "  \"code\": \"1003\", \n" +
                "  \"data\": [1, 2], \n" +
                "}\n";
        assertEquals(JSONPath.eval(temp, "$.data"), com.alibaba.fastjson.JSONPath.eval(temp, "$.data"));
    }
}

期待的正确结果

Expected :[1,2]
Actual :null

@Cooper-Zhong Cooper-Zhong added the bug Something isn't working label May 8, 2024
@wenshao wenshao added this to the 2.0.50 milestone May 8, 2024
@wenshao wenshao added the fixed label May 9, 2024
@wenshao
Copy link
Member

wenshao commented May 12, 2024

@wenshao wenshao closed this as completed May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed
Projects
None yet
Development

No branches or pull requests

2 participants