This question has already been answered:
- How and what to parse Json in Java? 4 replies
Hello. Need to parse such a json, how to do it?
{"code":200,"lang":"en-ru","text":["привет"]} PS The problem is that I can not pull the value of "text".
What I wrote:
try { JSONObject jObject = new JSONObject(strJson); JSONArray jArray = jObject.getJSONArray("text"); JSONObject two = jArray.getJSONObject(0); Toast.makeText(service.this, two.toString(), Toast.LENGTH_SHORT).show(); } catch (JSONException e) { e.printStackTrace(); } What's on output: ["привет"]
How to pull out this 0th array?
jArray.getString(0);try it. - eugeneek 2:55 pm