Q:

JSONPath union of multiple different paths

I am trying to build a single JSONPath query which will test existence of two or more paths.
Let's consider the following sample document:
{
          "firstName": "John",
          "lastName" : "doe",
          "age"      : 26,
          "address"  : {
            "streetAddress": "naist street",
            "city"         : "Nara",
            "postalCode"   : "630-0192"
          },
          "phoneNumbers": [
            {
              "type"  : "iPhone",
              "number": "0123-4567-8888"
            },
            {
              "type"  : "home",
              "number": "0123-4567-8910"
            }
          ]
}

So far I have found:
$..[firstName,lastName,type] 
And get all of these elements from the entire document.
But, what I need is to check two different paths, e.g.:
 $.firstName 
 $.address.city

Can this be done with a single JSONPath query? I cannot write anything like: 
$.[firstName,address.city]

With XML and XPath I could write: 
/person/firstname | /person/address/city

and get a union of all matching XML elements.
Can I do the same with JSONPath?

A:

I think the closest you can come in the original JSONPath is using recursive descent and union, i.e.
$..['firstName','city']

The Goessner implementation will return
[
   "John",
   "Nara"
]

kubernetes JSONPath supports an extension to the union operator, allowing
[‘metadata.name’, ‘status.capacity’]

where name and capacity are members of metadata and status.
JSONMatch, which is a variant of JSONPath, and originally based on the Kubernetes JSONPath parser, supports union of completely separate paths, e.g.
[employee[5].name, company.name, wageTiers[compensation > 10000]]

JSONMatch is available in go and I believe javascript also.
The jsoncons C++ library v0.123.0 supports JSONPath union of completely separate paths, including
$..[firstName,address.city]

