Possible Duplicate:
How to send a JSON object over Request with Android?
As I am new to Android development, I struck up with a problem sending requests to a web service in the form of JSON. Googling, I found the following code for sending requests using parameters. Here is the Java class we are sending parameters in the form of:
Main.java
RestClient client = new RestClient(LOGIN_URL);
client.AddParam("Email", _username);
client.AddParam("Passwd", _password);
try {
client.Execute(RequestMethod.POST);
} catch (Exception e) {
e.printStackTrace();
}
String response = client.getResponse();
But here I want to send parameters in the form of JSON, like for example I want to send parameters in this form:
{
"login":{
"Email":_username,
"Passwd":_password,
}
}
So, can anyone help me? How can I send parameters in the form of JSON?