0
votes

My HTTP request returns an array similar to

[
{"id":"1", "data":"abc"},
{"id":"2", "data":"def"},
{"id":"3", "data":"ghi"}
]

As an input for a ForEach Controller I'm trying to extract the ids of above result into an array using a JSON Path Extractor with a Path expression of $..id. I'm expecting to get something similar to ["1", "2","3"] but the output I get is

ids=3
ids_matchNr=3

It appears that the JSON Path Extractor only matches/extracts the last occurrence of id instead of collecting all occurrences of the id values and adding them to an aray.

The same expression and data return the expected ["1", "2","3"] result array in jsonpath.curiousconcept.com so the expression seems to be correct.

Am I doing something wrong or is this a bug in the JSON Path Extractor?

Below are some screen prints for a little test Input Array Declaration

JSON Extractor

Debug Output

1

1 Answers

1
votes

I cannot reproduce your issue:

  1. JSON Extractor

    JMeter JSON Extractor

  2. JSON Path Extractor

    JMeter JSON Path Extractor

So double check you are using the latest version of JMeter and JSON Path Extractor, the latter one can be upgraded using JMeter Plugins Manager