0

I'm trying to learn JSON path and I'm using the sample at https://codebeautify.org/jsonpath-tester# to practice.

I'm trying to extract the id based on the employee's first name as below:

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

However it returns all the ids. How do I pick the id based on firstName?

ratsstack
  • 1,012
  • 4
  • 13
  • 32

1 Answers1

1

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

You are missing @.firstName and ==

sjjk001
  • 175
  • 2
  • 12