Reputation: 1135
Below is the json response i am getting from a external service.
{"userAttributeList": [
{"Name":"PROFILE.UUID","Value":”SL1-4XXXXX0"},
{"Name":"PROFILE.UserId","Value":"[email protected]"},
{"Name":"PROFILE.FirstName","Value":"John"},
{"Name":"PROFILE.LastName","Value":"Smith"},
{"Name":"PROFILE.EmailAddress","Value":"[email protected]"},
{"Name":"SETTING.COMMON.REGIONAL_SETTINGS.DATEFORMAT_DATEPATTERN","Value":"dddd d MMMM yyyy"},
{"Name":"SETTING.COMMON.REGIONAL_SETTINGS.DATEFORMAT_TIMEPATTERN","Value":"HH:mm:ss"},
{"Name":"SETTING.COMMON.REGIONAL_SETTINGS.DATEFORMAT_TIMEZONE","Value":"Romance Standard Time"}
]}
I am stil trying the figure out a way to deserialize this . Its not in nor form. Can any one suggest a way to go a head with this.
Upvotes: 1
Views: 86
Reputation: 189
try {
JSONArray response=new JSONArray(jsonstring);
for (int i = 0; i < response.length(); i++) {
JSONObject data=response.getJSONObject(i);
String name=data.getString("Name");
String values=data.getString("Values");
//perform operation on name and values
}
} catch (JSONException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
Upvotes: 1