Hello Oleg, thanks for reply, to make it simple w...
# general
p
Hello Oleg, thanks for reply, to make it simple when my request & response are like below Request: "bodyPatterns": [ { "equalToJson": {"quantity": {"value": "${json-unit.any-number}", "unit": "${json-unit.any-string}"}} } ] Response: "quantity": { "value": {{jsonPath request.body '$.value'}}, "unit": "{{jsonPath request.body '$.unit'}}" } With that when executing with the value like { "quantity": { "value": 32000, "unit": "users"} } I am getting response like (value and unit is showing as empty) "quantity": { "value": , "unit": "" } But the same thing when the request formation is like "bodyPatterns": [ { "equalToJson": {"value": "${json-unit.any-number}", "unit": "${json-unit.any-string}"} } ] it works perfectly well, it returns whetever value passed during testing/execution. Which jsonPath missing level are you talking about, can you explaing please?
1
o
Should it be '$.quantity.value' in the JSON path?
p
Ahh yes it's true, i completely missed it, thanks a lot Oleg for rectifying it...appreciate it
o
Happy to help!
🙌 1
p
@Oleg Nenashev can you please help, for array of elements how it can be done? for eg: request is something like "entitle": [{"name": "${json-unit.any-string}", "value": "${json-unit.any-string}","quantity": {"value": "${json-unit.any-number}", "unit": "${json-unit.any-string}"}, "enforce_quantity": "${json-unit.any-boolean}"}] In response if I put it like "entitle": [ { "name": "{{jsonPath request.body '$.name'}}", "value": "{{jsonPath request.body '$.value'}}", "quantity": { "value": {{jsonPath request.body '$.quantity.value'}}, "unit": "{{jsonPath request.body '$.quantity.unit'}}" }, "enforce_quantity": {{jsonPath request.body '$.enforce_quantity'}} } ] while testing I am gettting empty response "entitle": [ { "name": "", "value": "", "quantity": { "value": , "unit": "" }, "enforce_quantity": } ]
was able to solve it Thanks!!
c
hello everyone! could you help me with something? I have the same problem @Prasenjit Dutta Could you give me the configuration of your request and response body? I am new at this I need to dynamically generate a json, according to the value received in the request
thanks!!!