问题
I am using the Gson function toJson for the =, > and < operators, and in the final string they are interpreted as \u003e.
Is there a special feature I need to add or take care of?
回答1:
You should disable HTML escaping, here is a sample that illustrates it:
Gson gson1 = new Gson();
String s1 = gson1.toJson("<>");
Gson gson2 = new GsonBuilder().disableHtmlEscaping().create();
String s2 = gson2.toJson("<>");
s1: "\u003c\u003e"
s2: "<>"
来源:https://stackoverflow.com/questions/17092044/gson-failure-to-conver-symbols