如何解析JSON字符串的Andr​​oid字符串、JSON、oid、Andr

由网友(有种你娶我)分享简介:我试图解析如下JSONString I'm trying to Parse the below JSONString [[{"0":"","title":" Technical Support Analyst in Noida","1":"","Company Name":" Oracle","2":"","...

我试图解析如下JSONString

I'm trying to Parse the below JSONString

[[{"0":"
","title":" Technical Support Analyst in Noida","1":"
","Company Name":" Oracle","2":"
","Category":"Fresher","3":"
","Job Type":"Full Time","4":"
","Location":"Noida","5":"
","Job Qualification":"BE/BTch/Bsc/Others","6":"
","Job Experience":"Freshers","7":"
","Job postdate":"2013-6-05","8":"
"}]]

下面我code:

// try parse the string to a JSON object
try {
    //jObj = new JSONObject(JsonString);
    JSONArray ja = new JSONArray(result);
    int size = ja.length();
    Log.d("tag", "No of Elements " + ja.length());
} catch (JSONException e) {
    Log.e("JSON Parser", "Error parsing data " + e.toString());
}

难道任何一个帮助,我的code不工作? 我想分析的标题,公司名称,类别等等...

Could any one help,My Code is not Working? I want to Parse title,CompanyName,Category Etc...

推荐答案

您需要从jsonstring创建 JSONArray

You need to create JSONArray from your jsonstring.

JSONArray JSONArray 然后 JSONObect ..

 try {
        JSONArray ja = new JSONArray(buffer.toString());
        JSONArray innerJsonArray = ja.getJsonArray(0);
        JSONObject object = innerJsonArray.getJSONObject(0);
        String title = object.getString("title");                
     } 
     catch (JSONException e) {
        Log.e("JSON Parser", "Error parsing data " + e.toString());
     }
阅读全文

相关推荐

最新文章