can a javascript json string be converted to a java object in java web? because i converted a arraylist to json string and send it to a jsp page, and in jsp page i want to iterate the json string, or is there any other way other than converting it to java object?
ie how can i use the name of the json string to set a input text box field.
[{"name":"john"},{"lastname":"nice"}];
and in input text
$("#textbox").val("namehere");
is it possible?
edited:
here are the steps that i am doing
i have a button which triggers ajax and in the servlet i parse a arraylist to json
ArrayList<UserProfile> users=new ArrayList<UserProfile>();
the UserProfile class is consist of name last name and email.
users.add(new UserProfile("john","garcia","john@asd.com"));
users.add(new UserProfile("cena",brock","brockceno@asd.com"));
and i return it to the jsp
out.println(gson.toJson(users));
and when i receive in ajax
succes:function(data){
//i want to access every element of the arraylist that is parse to json string
}