I use method toJson for generate json from object. I encountered an error with the translation of the object into the json view .
SingnUpRq singnUpRq = new SingnUpRq("lsjdflkdjslfk", "ZCqKckIpwvxtLFZz3TlUln5RqUpEB5U43imi7PSYv6UBY/bLvKQBSDIxXR5cAKnK+CU+UiyBB998fRJRvGJJDw==");
String postBody = gson.toJson(singnUpRq);
postBody (problem with last symbols == :{"DeviceId":"lsjdflkdjslfk","RefreshToken":"ZCqKckIpwvxtLFZz3TlUln5RqUpEB5U43imi7PSYv6UBY/bLvKQBSDIxXR5cAKnK+CU+UiyBB998fRJRvGJJDw\u003d\u003d"}
Why is this problem may occurr? How can I resolve this problem?
I found solution here: https://github.com/google/gson/issues/203
Instead use constructor new Gson()
, need use
Gson gson = new GsonBuilder().disableHtmlEscaping().create();