如何解析JSON数组(语言数组)?

时间:2015-05-29 10:02:42

标签: android

我想从JSON数组中获取字符串值,并将其设置为Android中的微调器。我怎么能够  做这个?

`{"languages":["English","Hindi","Punjabi","",""]} `languages":["English","Hindi","Punjabi","",""]} 

1 个答案:

答案 0 :(得分:1)

您可以像这样解析JSONARRAY

if (jsonResultArry != null) {
            for (int i = 0; i < jsonResultArry.length(); i++) {

                try {

                JsonObject jsonPblm = jsonResultArry.getJSONObject(i);
                    pblmId = jsonPblm.getString("id");
                    ticketDate = jsonPblm.getString("ticket_date");
                    pblmName = jsonPblm.getString("description");

                } catch (JSONException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }