为什么返回所有 ID 而不是一个匹配的搜索条件

Why are all ids being returned instead of the one matching search criteria

我正在尝试学习 JSON 路径,我正在使用 https://codebeautify.org/jsonpath-tester# 中的示例进行练习。

我正在尝试根据员工的名字提取 ID,如下所示:

$.employees.employee[?(@firstName='Tom')].id

但是它 returns 所有的 id。如何根据名字选择 ID?

尝试:$.employees.employee[?(@.firstName == 'Tom')].id

您缺少 @.firstName==