I got an asp.net WCF which contain a function that will serialize the LINQ results and return me this json string
"[{\"intPromoter\":1,\"varID\":\"DP900001\",\"varName\":\"Jay Chou\"}]"
But it seem like a bit different from what i'm learn json so i added "rows" with this code in android java
text = "{\"rows\":" + text + "}";
and it become like this
{"rows":"[{\"intPromoter\":1,\"varID\":\"DP900001\",\"varName\":\"Jay Chou\"}]"}
so when i use the below function to parse into json array it's give me java.lang.string cannot converted to jsonarray. So I'm not sure is string from .net need to change into certain format before read by json or is there a direct way without add "rows" at the beginning. Thanks in advance.
JSONObject jObject = new JSONObject(results);
JSONArray jArray = jObject.getJSONArray("rows"); //This LINE GIVE error,
for (int i=0; i < jArray.length(); i++)
{
JSONObject oneObject = jArray.getJSONObject(i);
int intPromoter =Integer.parseInt(oneObject.getString("KEY_intPromoter"));
String varID = oneObject.getString("KEY_varID");
String varName = oneObject.getString("KEY_varName");
}