Ipexidex725
Ipexidex725

Reputation: 39

How can I JSON path without a values?

So, I'm wondering how I can JSON path to the id 508018304019857419, I'm trying out $[?(@ == 508018304019857419)].rolesList but it just doesn't work. What can I do?

I'm trying to find 508018304019857419 and collect rolesList

JSON:

[
   {
      "508018304019857419":{
         "rolesList":[
            "Guest",
            "Presidential Team",
            "Chief Executive Officer",
            "[-] Co Founder",
            "[-] Founder",
            "[-] Group Holder"
         ]
      }
   },
   {
      "222078108977594368":{
         "rolesList":[
            "Guest",
            "Test1",
            "Test2",
            "Test3",
            "Test4",
            "Owner"
         ]
      }
   }
]

Upvotes: 1

Views: 58

Answers (1)

hobbs
hobbs

Reputation: 239881

$.[508018304019857419].rolesList should do.

$. is all children of the root, [508018304019857419] is the "508018304019857419" key of each of them (the ones that don't have such a key are filtered out), and then .rolesList drills down.

Upvotes: 1

Related Questions