Given a string:
val json = """{"id":"derp"}"""
When I try to retrieve the value of ID using JsonPath I get the empty iterator
import io.gatling.jsonpath.JsonPath
JsonPath.query("$.id", json).right.get
// Iterator[Any] = empty iterator
How do I get the value of id?
Although the type of the second arg to
JsonPath.query
isAny
, this function does not seem to support multiple types of arguments. It does not parse the input string, but expects it already to be parsed. Looks a bit weird as design choice.So, supposing that Jackson is used as the parser lib, the following will work and select the value under
id
key: