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\\\"
params.toString()
is a string representation of the JSON, not a User object.
I tried s.replace("\"", "\"")
You didn't need to do that... Java is showing the string with escape characters. If you see the escape characters, then you've converted an existing JSON string into another JSON object, and string-ed it again.
String jo=userGson.toJson(u);
Why are you not logging this instead?
I guess its not even calling this toString method
Well, you never printed a User object