I have my client as an android program. I take the user details from the the user and send it to the server for storing it in the database. I have used a URLConnection object to send data to the servlet. I am sending the user details in using 'writeObject'.
URL url = new URL("http://10.0.2.2:8080/hello");
URLConnection connection = url.openConnection();
connection.setDoOutput(true);
ObjectOutputStream out=new ObjectOutputStream(connection.getOutputStream());
String s="check"+","+susername+","+password+","+email;
out.writeObject(s);
out.flush();
out.close();
As you see I have seperated the details with ",". In the servlet, I used string .split() function to retrieve back the values. It is working perfectly fine. Except that I see and hear people telling me to send it in json format because it is faster. I don't understand how? The content is going to be the same right? Is it completely different protocol for transfering data? How should it be used? please suggest some links if you think this is a very trivial question.