Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

JSONpath Expression for GET call #66

sadams3180 opened this Issue Jul 30, 2013 · 4 comments


None yet
3 participants

Hi Fabrizo,

The following JSONpath expression works in a GET call in Fitnesse.
| GET ||||jsonbody.albums.title=="Black"|

{"name":"Metallica","albums":[{"year":"1991","title":"Black","tracks":["1:Enter Sandman","2:Holier Then Thou","3:The Unforgiven"]}]}

My question is this. Is there a similar JSONpath expression that can be used in a GET call to see if an object contains a character(s) rather than an entire value?
For example rather then jsonbody.albums.title=="Black" I would use something like jsonbody.albums.title=="Bla".

Does such an expression exist for Restfixture in a GET call?


smartrics commented Aug 1, 2013

you can use any javascript expression in the cell, provided that the last expression returns a boolean
check the livedocs for examples

@smartrics smartrics closed this Aug 1, 2013

Thanks Fabrizo, you happen to have an example of a contain expression that would work with Restfixture/Fitnesse? Ones I tried didn't work unfortunutly.
Example of ones not working:
| GET |||| jsonbody.albums.[?(@.title:contains(Bla))] |
| GET |||| $.[?(@.albums.title:contains(Bla))] |

I'm probably missing something. Any help is appreciated.


smartrics commented Aug 1, 2013

any javascript tutorial would tell you how to manipulate strings
for example

jsonbody.albums[0].title.indexOf("Bla") >=0

should do


What if you want to check album which title is "Black" was published on year 1991 (suppose there are several albums for Metallica) ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment