I want to send Params in particular format to the server.
This is the format:
{
"institute": {
"name": $scope.formData.institute_name,
"state": $scope.formData.state,
"city": $scope.formData.city,
"pin_code": $scope.formData.pincode,
"nature": $scope.formData.nature,
},
"user": {
"role": $scope.formData.role,
"user_id": $scope.user_id
}
};
And I can send in this format but the problem is a value inside institute
and user
is going as String. And I want value inside it also go as key and value.
So I need to return params like Map<String,Map<String,String>>
this
I tried this but it didn't work
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String, String> instituteParams = new HashMap<>();
instituteParams.put("name", institute);
instituteParams.put("state", state);
instituteParams.put("city", city);
instituteParams.put("pin_code", pincode);
instituteParams.put("nature", nature);
JSONObject objectInstitute = new JSONObject(instituteParams);
Map<String, String> userParams = new HashMap<>();
userParams.put("role", role);
userParams.put("user_id", userid);
JSONObject objectUser = new JSONObject(userParams);
Map<String, String> params = new HashMap<>();
params.put("institute", objectInstitute.toString());
params.put("user", objectUser.toString());
return params;
}