I want to match a request body using Wiremock dotnet. Sample request body
{ "name": "ashutosh", "age": 33 }
I want to match it with one of the key value combination like either age or name.
I tried the below combinations but nothing seems to match
"Body":{
"Matcher": {
"Name": "JsonPathMatcher",
"Pattern": "$.[?(@.name == 'ashutosh')]"
}
}
"Body":{
"Matcher": {
"Name": "JsonMatcher",
"Pattern": "{ \"age\": 33}"
}
}
Can somebody help me with this? Thanks in advance
Figured out the answer. We need to use double dots instead of one dot I have used in JsonPathMatcher like this:
"Body":{
"Matcher": {
"Name": "JsonPathMatcher",
"Pattern": "$..[?(@.name == 'ashutosh')]"
}
}