由于某种原因,以下字符串无法转换为JSONArray。我不知道为什么: 这是字符串:
[{"article_number":"2.","article_title":"Supremacy of this Constitution","chapter_id":"1","part_id":"0","article_id":"2"},
{"article_number":"3.","article_title":"Defence of this Constitution","chapter_id":"1","part_id":"0","article_id":"3"}]
这是代码:
try{
//Load the sqlite DB here:ARTICLES TABLE
json_array=new JSONArray(response_articles.trim());
int len=json_array.length();
for(int i=0;i<len;i++){
JSONObject json_obj=json_array.getJSONObject(i);
String article_id=json_obj.getString("article_number");
String part_no=json_obj.getString("article_title");
System.out.println(article_id+"........................................................................,"+part_no);
//String chapter_id=json_obj.getString("chapter_number");
//String chapter=json_obj.getString("constitutionChapters");
}
}catch(Exception e){
e.printStackTrace();
}