https://linen.dev logo
#general
Title
# general
p

Prasenjit Dutta

06/16/2023, 8:30 PM
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

Oleg Nenashev

06/16/2023, 9:54 PM
Should it be '$.quantity.value' in the JSON path?
p

Prasenjit Dutta

06/17/2023, 6:49 AM
Ahh yes it's true, i completely missed it, thanks a lot Oleg for rectifying it...appreciate it
o

Oleg Nenashev

06/17/2023, 6:56 AM
Happy to help!
🙌 1
p

Prasenjit Dutta

06/20/2023, 11:48 AM
@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

Carlos Villar

09/12/2023, 2:09 PM
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!!!
5 Views