0

I'm trying to extract highest value on array containing Null values; jmeter doesn't doing it, anyone know why?

using: max(result[].data[].values[]) works fine at https://jmespath.org/tutorial.html

ERROR o.a.j.e.j.j.JMESPathExtractor: Error processing JSON content in JSON JMESPath Extractor, message: Invalid argument type calling "max": expected array of number or string but was array containing array

{
    "result": [
        {
            "metricId": "count.server",
            "data": [
                {
                    "dimensions": [
                        "SERVICE_METHOD"
                    ],
                    "dimensionMap": {
                        "dt.entity.service_method": "SERVICE_METHOD"
                    },
                    "values": [
                        null,
                        null,
                        1,
                        null,
                        null,
                        1,
                        null,
                        null,
                        null,
                        null,
                        null,
                        null,
                        1,
                        1,
                        null,
                        null,
                        4,
                        null
                    ]
                }
            ]
        }
    ]
}
Cleber
  • 5
  • 4

1 Answers1

0

I don't think that the expression "works fine" as it produces something like:

enter image description here

So you need to:

  1. Get rid of this nested JSON Array
  2. Get rid of these null entries

Example JMESPath query would be something like:

result[0].data[0].values[? @ != null] | max (@)

Demo:

enter image description here

More information: The JMeter JSON JMESPath Extractor and Assertion: A Guide

Dmitri T
  • 159,985
  • 5
  • 83
  • 133