I am parsing a JSON like below:
jobs1: [
{
request: {
body: {
jobID: "79ceeeff-53b9-4645-80bd-95dfca6fe1e9",
...
jobs2: [
{
request: {
body: {
jobID: "60e7c286-f936-4f96-87bc-6bd55f107514",
And looking for a way to use wildcards in the JSON path.
I am using the RestAssured framework in Java. After executing the code like below:
List<String> ids = get("/state/").path("*.request.body.jobID");
System.out.println(ids);
I expect to get:
[79ceeeff-53b9-4645-80bd-95dfca6fe1e9, 60e7c286-f936-4f96-87bc-6bd55f107514]
But instead I get an exception:
java.lang.IllegalArgumentException: Invalid JSON expression:
Script1.groovy: 1: unexpected token: *. @ line 1, column 27.
*.request.body.jobID
^
I have looked through these tutorials, but nothing seemed to work for me:
https://github.com/json-path/JsonPath
http://goessner.net/articles/JsonPath
How do I correctly use the wildcards in JsonPath?