Advertisement
Guest User

Untitled

a guest
Jan 10th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. //saving in JSON form
  2.  
  3. JSONObject json=new JSONObject();
  4. JSONArray jarray=new JSONArray();
  5. JSONObject details;
  6. try
  7. {
  8. for(int i=0;i<10;i++)
  9. {
  10. details = new JSONObject();
  11. details.put("firstname:",fname);
  12. details.put("lastname:",lname);
  13. details.put("username:",uname);
  14. details.put("email:",email);
  15. details.put("password:",pswd);
  16. details.put("confirm password:",repswd);
  17. details.put("phonenumber:",phonenumber);
  18. details.put("security question:",SecurityQuestion);
  19. details.put("answer:",tarea);
  20. jarray.put(details);
  21. }
  22. json.put("details",jarray);
  23. }
  24. catch(JSONException e)
  25. {
  26. out.print("unable to save in JSON File");
  27. e.printStackTrace();
  28. }
  29. response.setContentType("application/json");
  30. response.getWriter().write(json.toString());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement