0

The following string cannot be converted to a JSONArray for some reason. I do not know why: This is the string:

[{"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"}]

This is the code:

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();
        }
4

0 回答 0