My need: I want to build a path containing filters on my JSON response.
//Simple path - OK
response.Node1.Node2.Node3.Node4
//Path with list - OK
response.Node1.Node2.Node3[1].Node4
//Path with condition (filter) - NOK
response.Node1.Node2[?(@.Node3 == 'value')].Node3bis
Postman does not understand the [?(@.Node3 == 'value')] syntax as jsonPath is not supported natively.
Hence, I am trying to import the jsonPath js library in Postman, and I have found two:
Researches
I already read this post, and none of the answers satisfy my needs.
Postman js code is limited to the sandbox.
Postman limits libraries to this list.
There is a trick (check TIP #5) to add js code as global variable, and call it in requests. However it does not work for jsonPath project as it is not just a simple function but a whole project. I tried many different ways, but still unable to call the jsonPath functions from my Postman Test.
I also read the related Postman issue.
From GitHub community, this issue was closed in favor of this one. Which has been closed in favor of this one. Which is opened without clear answer (only small tricks mentioned above) since June 2015.
Unknown domains
Even if I read their global use, I do not know anything technical about NodeJs / NPM / Newman.
But I read that postman supports NodeJs, allows to generate NodeJs code snippet and I saw that jsonPath library can be imported using NodeJs.
Maybe something can be done from there, but I don't have the expertise to make it happen.
Question:
Does anyone knows how to make it work altogether ?
I mean, find a way to use jsonPath expression, thanks to the jsonPath js library, in postman... Please help.
Any postman collection making it work is welcome :).