I have a url that gives me the data in this format:
{"to": "DKK", "rate": 7.4417, "from": "EUR"}
I'm trying to read them as follows:
JSONObject obj = new JSONObject();
JSONObject obj2 = obj.getJSONObject(site);
String to = (String)obj2.get("to");
Double rate = obj2.getDouble("rate");
ERROR :
org.json.JSONException: No value for link 04-22 23: 06: 56,114 19331-19991 / com.converter.android.converter W / System.err: at org.json.JSONObject.get (JSONObject.java:389) 04-22 23: 06: 56,114 19331-19991 / com.converter.android.converter W / System.err: at org.json.JSONObject.getJSONObject (JSONObject.java:609) 04-22 23: 06: 56.114 19331-19991 / com.converter.android.converter W / System.err: at com.converter.android.converter.ConvertActivity $ Parse.doInBackground (ConvertActivity.java:1579) 04-22 23: 06: 56.114 19331-19991 / com.converter.android.converter W / System.err: at com.converter.android.converter.ConvertActivity $ Parse.doInBackground (ConvertActivity.java:1547) 04-22 23: 06: 56.114 19331-19991 / com.converter.android.converter W / System.err: at android.os.AsyncTask $ 2.call (AsyncTask.java:295) 04-22 23: 06: 56.114 19331-19991 / com.converter.android.converter W / System.err: at java.util.concurrent.FutureTask.run (FutureTask.java:237) 04-22 23: 06: 56.114 19331-19991 / com.converter.android.converter W / System.err: at android.os.AsyncTask $ SerialExecutor $ 1.run (AsyncTask.java:234) 04-22 23: 06: 56.114 19331-19991 / com.converter.android.converter W / System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1113) 04-22 23: 06: 56.114 19331-19991 / com.converter.android.converter W / System.err: at java.util.concurrent.ThreadPoolExecutor $ Worker.run (ThreadPoolExecutor.java:588) 04-22 23: 06: 56.114 19331-19991 / com.converter.android.converter W / System.err: at java.lang.Thread.run (Thread.java:818)
Can someone help me?