LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

JKI JsonText filter if field contains sub-string

Hi, I am trying to filter this Array:

 

Spoiler
[    {
    "folder" : "User/Admin/UserA",
    "User" :  "Linda"
},
 {
    "folder" : "User/Service/UserB",
    "User" :  "John"
},
{
    "folder" : "User/Admin/UserC",
    "User" :  "Peter"
} ]

 I want to get a Array with all Clusters where folder contains "Admin"

This $Path gives me one result in my case.
$..[?(@.folder=="User/Admin/UserA")]

 

How can I receive all folders? Something like  $..[?(@.folder=="User/Admin/*")] isn't working. Are regEx operators (=~) or the query command contains not working?

 

Thank you,

Bow

0 Kudos
Message 1 of 2
(573 Views)

Hello!

 

Would this work for your case?

INPUT

{
    "key": "value",
    "folder": [
        {
            "key": 1
        },
        {
            "key": 2,
            "dictionary": {
                "User A": "Linda",
                "User B": "John",
                "User C": "Peter"
            }
        },
        {
            "key": 3
        }
    ]
}
QUERY
$.folder[?(@.key==2)].dictionary
0 Kudos
Message 2 of 2
(533 Views)