Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JsonPath get length of array after filter

Tags:

jsonpath

Hi I want get legth of array after Filter with JsonPath.

Is it possible ?

My filter is $.issues.[?(@.severity == 'MAJOR')].length()

My Json is

{
  "issues": [
        {
            "severity": "MAJOR"
        },
                {
            "severity": "MINOR"
        },
                {
            "severity": "MAJOR"
        },
                {
            "severity": "MAJOR"
        },
                {
            "severity": "MAJOR"
        }
]
  
}
like image 813
Matthis.h Avatar asked Feb 13 '26 09:02

Matthis.h


1 Answers

Possible workaround for Jayway JsonPath implementation

$.length($.issues.[?(@.severity == 'MAJOR')].length())
like image 100
Akshay G Avatar answered Feb 23 '26 03:02

Akshay G