[Solved] How to read json with this format


Don’t use the getJsonObject() method to get the values inside the JSONObject, but use the corresponding getters for the types of the values. The key-value pairs themselves are no JSONObjects.

 JSONObject jsonObj = new JSONObject(response);

 String fromCurrency = jsonObj.getString("from");
 String toCurrency= jsonObj.getJSONObject("to");
 Double fromAmount = jsonObj.getDouble("from_amount");
 Double toAmount= jsonObj.getDouble("to_amount");

solved How to read json with this format