I have scenario, we need to read the latitude and Longitude from json response body. The latitude and longitude has value like below
"data": [{
"city": "Mumbai",
"country": "India",
"latitude": 19.0886993408,
"longitude": 72.8678970337
}
when We try to validate the JSON response by reading the latitude and longitude using JSONPATH
using getString()
then it round off the value after 4 digit in decimal places.
Below is the code in java
String key = item.getKey();
String value = item.getValue();
JsonPath jsonPathEvaluator = response.jsonPath();
String strjson = jsonPathEvaluator.getString(key).toString().replaceAll("\\[\\](){}]", "");
Output display:
Latitude:-19.0887 instead of 19.0886993408