I am trying to convert a java object to json using Gson. But when i tried printing it out.I got this JSON
{\"user\":\"{\\\"email\\\":\\\"abc@gmail.com\\\"
You've already converted it to a JSON string, then you stick that into a JSON object which automatically escapes the JSON string. Try something like this:
User u=new User(name,lastName,email,phone,password);
Gson userGson=new GsonBuilder().create();
JSONObject params = new JSONObject();
params.put("user",user);
Log.e("in register", userGson.toJson(params));