i have a JSON string
[
{"created_at":"Thu Jan 24 07:27:12 +0000 2013",
"id":294345590119227392,
"user":{
"id":213539531,
"name":"Hamid",
"screen_name":"HamidMirGEO",
},
"retweeted":false
}]
Parsing Using following code
InputStream is = this.getResources().openRawResource(R.raw.jsontwitter);
byte [] buffer = new byte[is.available()];
while (is.read(buffer) != -1);
String jsontext = new String(buffer);
JSONArray entries = new JSONArray(jsontext);
for (i=0;i<entries.length();i++)
{
JSONObject post = entries.getJSONObject(i);
x += "Date:" + post.getString("created_at") + "\n";
x += "Post:" + post.getString("text") + "\n\n";
x += "Pp:" + post.getString("screen_name") + "\n\n";//error reading this
}
Successfully parse first two but facing problem reading the data in second braces {};
any solution of this.
Use:
Instead of: