WireMock stub to return one element from a JSON array

103 Views Asked by At

I am using a standalone version of WireMock for my application. Previously I had mappings.json where some my endpoints returned a json arrays that were stored in separate files. Like

{
 "mappings": [
{ 
"request": {
"url" : "/path",
"method" : "GET"
},
"response":
  "status": 200,
  "bodyFileName": "fileName.json"
}
]

}

Now I want to return only one JSON object from that file's array according to the query param. For example return an object by its id

Is it possible using WireMock? I've tried a few ways, but nothing is working.

0

There are 0 best solutions below