I'm a bit new to this and it's doing my head in! I keep getting this error:
Error parsing data org.json.JSONException: No value for tname
This is the json:
[{"tname":"2"},{"kword":"||ice+skating+rink"}]
And here is my java code:
String result = response.toString();
            try
            {
                JSONArray jArray = new JSONArray(result);
                for (int i = 0; i < jArray.length(); i++) {
                    JSONObject json_data = jArray.getJSONObject(i);
                    Log.i("log_tag", ", type: " + json_data.getString("tname")+
                            ", keyword: " + json_data.getString("kword"));
                    type += json_data.getString("tname");
                    keyword += json_data.getString("kword");
                }
Any help greatly appreciated.
tname. Three possible solutions: a) Make sure your data has all the expected properties. b) Don't access propertytname. c) Test the existence of the property before you access it.