Using Restassured 3.0.1
I have a Json ::
json = {
"prices": {
"Test": {
"PriceMap": {
"30": "295"
}
}
}
}
JsonPath jsonPath = new JsonPath(json);
jsonPath.get("prices.Test.PriceMap.*")
getting error :
Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script1.groovy: 1: unexpected token: * @ line 1, column 48. otObject.prices.Test.PriceMap.*
You can use the getMap call to get the object as a map -- jsonPath.getMap("prices.Test.PriceMap")
System.out.println(jsonPath.getMap("prices.Test.PriceMap").keySet());
//Output : [30]
System.out.println(jsonPath.getMap("prices.Test.PriceMap").values());
//[295]
System.out.println(jsonPath.getMap("prices.Test.PriceMap").get("30"));
//295