I have a string comming from php looking exactly like that : "[{"id":"0","noteText":"Noteeeeeeee","date":"1232131","author":"John","authorId":"1"},{"id":"1","noteText":"Noteeeeeeee","date":"1232131","author":"Rob","authorId":"1"}]"
Then in my onCreate
in the mainActiviry.java
I got to this point :
String json = allNotes;
//System.out.println("String to Json Array Stmt");
JsonParser parser = new JsonParser();
JsonElement notes = parser.parse(allNotes);
JsonArray notesArr = notes.getAsJsonArray();
My goal is to parse the json string to array of json objects, then loop over it and feed it to a ListView
. The problem is that I cannot get there, since I am failing to loop over this jsonArray
. My java knowledge is too limited, so other questions didn't help me much.
Can someone help, please?
p.s. i am using gson