Object Identifier-Index: .foo
The simplest useful filter is
$.foo
. It produces the value at the key "foo", or empty list if there's none present.For example given input {"make": "Nissan", "model": "Kicks"}
and filter $.make
it produces "Nissan"
Now you try to create a JQ expression that would product the result.
Input:
1{
2 "firstName": "Charles",
3 "lastName": "Doe"
4}
JsonPath expression: Expected:
1[
2 "Charles"
3]