Hello, through Ajax I send json an array to a servlet, I cannot accept it correctly on a servlet, please help with this problem. Here is my Ajax:
$.ajax({ type: 'POST', data: ko.toJSON(self.ViewMass()), content: "UTF-8", contentType: 'application/json', url: "http://localhost:8080/MyDiplomka/ServResult", success: function (responseText) { var a = responseText; alert(a); } }); everything is in order in the Ajax, through the firebag you can see that an array of this type is sent to the servlet:
[ {"QContent":"3+5", "Answers":[ {"AContent":"8","RAnswer":false}, {"AContent":"22","RAnswer":false}, {"AContent":"33","RAnswer":false} ] } ] In a servlet I try to get this array, but it doesn’t really work out (I try to parse with json-simple), tell me how I can get such an array, now I just read it into a string and output, here’s the servlet itself:
request.setCharacterEncoding("UTF-8") BufferedReader br = new BufferedReader(new InputStreamReader(request.getInputStream())); String wq = br.readLine(); System.out.println(wq);