I have JSON response:
{"error":100,"result":"{\"distance\":2.4,\"duration\":5,\"price\":0}"}
From this response I want to get a "distance" value for example. How to do it?
I tried to do like this:
String distance = String.valueOf(finalResponseDataJOSNObject.getDouble("distance"));
but string value is null. Any ideas?
UPDATE:
Finally we discovered that it was back-end issue and we fixed it. No additional operations like JSONObject conversation to String, special character removal, etc. was necessary.
Simply:
String distance =
String.valueOf(finalResponseDataJOSNObject.getJSONObject("result").getDouble("distance"));