This message was deleted.
# wiremock-java
s
This message was deleted.
👀 1
t
Hi @Pavel Serada Have you tried something like:
Copy code
{{{jsonPath request.body '$..paths[1].source[0]'}}}
a
@Pavel Serada I think it is your double
.
between the
$
and the rest of the expression. The following returned what you’d expect:
Copy code
"response": {
    "status": 200,
    "body": "{\"id\":  \"{{{jsonPath request.body '$.paths[1].source'}}}\" }"
  }
Copy code
{
  "id": "blablablah2"
}
As for why… I don’t know 🤷🏻
t
$..
is a query, meaning it always returns a list of results
Whereas a single
.
indicates a selector, which is potentially only one element.
a
That’s what OP wants in this case, right? Just one element, instead of a list/array?
t
Yes, I think your solution is probably the more elegant one!
👍🏻 1
a
😅 One day I’ll learn jsonPath querying syntax… But today is not that day 😛
p
going to give it a try in a sec, thanks guys!
It worked! really appreciate your help, guys! @Tom @Aaron!!!
👍🏻 1
👍 1