Posted by
sapan
on
- Get link
- Other Apps
{ "base":"USD", "date":"2017-07-04", "rates":{ "AUD":1.3144, "BGN":1.7227, "BRL":3.3034, "CAD":1.2975, "CHF":0.96486, "CNY":6.8017, "CZK":23.018, "DKK":6.5504, "GBP":0.77341, "HKD":7.8082, "HRK":6.5326, "HUF":271.56, "IDR":13366.0, "ILS":3.516, "INR":64.738, "JPY":113.25, "KRW":1151.8, "MXN":18.212, "MYR":4.2975, "NOK":8.3546, "NZD":1.3736, "PHP":50.509, "PLN":3.737, "RON":4.0416, "RUB":59.315, "SEK":8.5207, "SGD":1.383, "THB":34.015, "TRY":3.5565, "ZAR":13.228, "EUR":0.88082 } }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | String jsonText = "{\"base\":\"USD\",\"date\":\"2017-02-17\",\"rates\":{\"AUD\":1.3044,\"BGN\":1.8364,\"BRL\":3.0918,\"CAD\":1.3079,\"CHF\":0.99878,\"CNY\":6.867,\"CZK\":25.372,\"DKK\":6.9797,\"GBP\":0.80488,\"HKD\":7.7614,\"HRK\":6.9869,\"HUF\":289.5,\"IDR\":13332.0,\"ILS\":3.7061,\"INR\":67.1,\"JPY\":112.75,\"KRW\":1150.0,\"MXN\":20.474,\"MYR\":4.453,\"NOK\":8.3235,\"NZD\":1.3905,\"PHP\":50.055,\"PLN\":4.0662,\"RON\":4.2463,\"RUB\":58.185,\"SEK\":8.8712,\"SGD\":1.4165,\"THB\":34.995,\"TRY\":3.673,\"ZAR\":13.085,\"EUR\":0.93897}}"; // First get Complete Json JSONObject parseJson = new JSONObject(jsonText); // get the Rate object JSONObject rates = parseJson.getJSONObject("rates"); // Iterate for all the rates Iterator itr = rates.keys(); // loop while (itr.hasNext()) { String data = (String) itr.next(); System.out.println(data); } |
Comments
Post a comment