试试下面的代码。
try {
JSONArray ja = new JSONArray(json);
int size = ja.length();
Log.d("tag","No of Elements " + ja.length());
for (int i = 0; i < size; i++) {
String str = ja.getString(i);
String href = str.substring(str.indexOf("href=") + 5,
str.indexOf(">"));
Log.d("tag",href);
}
} catch (JSONException e) {
e.printStackTrace();
}
在这段代码中,json将是你的字符串,比如
String json = "[\"<a href='http://adda.com/jsonFeed/faJsonFeedDetails.php?jid=12036'>SPICE JET Recruits Freshers Data Entry Operator in Gurgaon</a><br><br><br>\",\"<a href='http://adda.com/jsonFeed/faJsonFeedDetails.php?jid=12035'>TOSHIBA Freshers off Campus Drive Trainee Engineers in Bangalore </a><br><br><br>\",\"<a href='http://adda.com/jsonFeed/faJsonFeedDetails.php?jid=12034'>EMC Corporation Recruits Fresher Jobs Technical Support Engineers in bangalore</a><br><br><br>\"]";
输出将如下所示。
06-04 16:50:44.632: tag : 'http://adda.com/jsonFeed/faJsonFeedDetails.php?jid=12036'
06-04 16:50:44.632: tag : 'http://adda.com/jsonFeed/faJsonFeedDetails.php?jid=12035'
06-04 16:50:44.632: tag : 'http://adda.com/jsonFeed/faJsonFeedDetails.php?jid=12034'