How to reference key from same JSON during response templating in Wiremock Standalone
I'm using WireMock Standalone to mock API responses, and I need to dynamically calculate values within my response templates. Specifically, I want to perform basic arithmetic operation (multiplication) on values extracted from the request.
{
"price": {{jsonPath node $.price}},
"quantity": {{jsonPath node $.quantity}},
"amt": {{multiply (parseInt (this.price)) (parseFloat (this.quantity))}}
}
To achieve the desired outcome, I need to multiply the 'price' and 'quantity' values...