From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

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
(588 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
(548 Views)