There is the received JSON data: {"code":200, "lang":"en-ru", "text":["какой-то текст"]} . How to pull out the value of "text" if it is an array?

    1 answer 1

      String json= " {\"code\":200, \"lang\":\"en-ru\", \"text\":[\"какой-то текст\"]}"; try { JSONObject rootJson = new JSONObject(new JSONTokener(json)); JSONArray textJson = rootJson.getJSONArray("text"); for (int i = 0; i < textJson.length(); i++) { Log.d("TAG", textJson.getString(i)); //какой-то текст } } catch (JSONException e) { e.printStackTrace(); }