Given the following JSON
{
"Users":[
{
"Username":"John",
"Password":"Doe"
},
{
"Username":"Anna",
"Password":"Smith"
},
{
"Username":"Peter",
"Password":"Jones"
}
]
}
I am trying to extract an array list of UserName & Password
JSONObject jobj = new JSONObject(jsonData);
JSONArray userArray = jobj.getJSONArray("Users"); // Now I got the Array of Users
I need to do something to extract all the user and password. What function is there for this? I am using the org JSON library
for (int i=0;i<userArray.length();i++)
{
// something like that
usernameList = userArray[i].getData("Username");
passwordList = userArray[i].getData("Password");
}