I have the following json data:
{
"data": [
{
"ticket": "249 [DH-249]",
"id": 249,
"priority": 3,
"title": "kUYWr7gWGH",
"queue": {
"title": "Django Helpdesk",
"id": 1
},
"status": "Open",
"created": "4\u00a0hours ago",
"due_date": "13\u00a0hours ago",
"assigned_to": "uUAKA3ZA 2rg8oS9X",
"submitter": "[email protected]",
"row_class": "",
"time_spent": "",
"kbitem": ""
},
{
"ticket": "250 [DH-250]",
"id": 250,
"priority": 3,
"title": "3kEpyPXp4",
"queue": {
"title": "Django Helpdesk",
"id": 1
},
"status": "Open",
"created": "4\u00a0hours ago",
"due_date": "13\u00a0hours ago",
"assigned_to": "None",
"submitter": "[email protected]",
"row_class": "",
"time_spent": "",
"kbitem": ""
}
],
"recordsFiltered": 195,
"recordsTotal": 195,
"draw": 1
}
How can i get an array of IDs where the priority is equal to minimal? For example, if the minimal priority is 3 in the data, I need to get id=249, id=250 (there's more data usually)
I have tried using the JsonPath expression gpt gave me: $.data[?(@.priority == $.data[*].priority.min())].id but it does not work
I don't think you can get it using JSONPath as current implementation doesn't allow evaluating
min()function properly.You can switch to JSR223 PostProcessor and use the following code to parse the response and extract all
idattributes of the minimum priority:More information: