Unable to use JsonPath expressions with filters

I am trying to use a JSONPath expression which has filter expressions. I validated the JSONPATH online using a online validator and it’s correct but upon using the same in the postman I get a syntax error. Not sure what I am doing wrong and I am unable to find any info or posts regrading the same.
Here is line of code where I am trying to store the NAME of the player whose ID is ‘56782’.
Note: The response I receive is in XML and PLAYERS is an array.

var responseJson = xml2Json(responseBody);
var JuniorLeaguePlayer = responseJson.RSP.ACTIVE.PLAYERS[?(@.ID=="56782")].NAME;

You do realize that you are in a JavaScript context, working with objects and arrays. Not sure how this can work.

you can try to put it into a new array, maybe it will be useful.
pm.test(‘Check of name’, () => {

let jsonData = xml2Json(responseBody),

    names= [];

_.each(jsonData, (item) => {

    if(item.RSP.ACTIVE.PLAYERS.ID=== '56782') {




1 Like