更新时间:2023-01-15 23:40:59
请注意,&"是正确的" JSON,因此无论您是否不想在JSON中使用实体,JavaScript都可以正确地转义.您要禁用html格式/转义.
Note that """ is "Proper" JSON, so your javascript can be escaped properly, anyways if you dont want to use entities in you JSON perhaps you want to disable html formatting/escaping.
尝试使用
Gson gson = new GsonBuilder().disableHtmlEscaping().create();
检查GSONBuilder对象文档 http://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/GsonBuilder.html
Check the GSONBuilder Object Documentation http://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/GsonBuilder.html