json 在网页输出多了转义字符

xianzi1261618338 2014-03-09 12:12:28
控制台的输出
页面输出:

XML的代码:
<action name="get_rooms" class="getRoomAction">
<result type="json">
<param name="root">result</param>
</result>
</action>


主要的java 代码:

package util;



import java.util.List;

import com.sun.mail.handlers.image_gif;

import net.sf.json.JSONObject;
import vo.Room;

public class JsonFormat {
private RoomProxy roomProxy;
private JSONObject jo;
private String result;

public String getJsonforRoom(List<Room> list){
if(list.size()<0){
return null;
}
result="{\"total\":"+list.size()+",\"rows\":[ ";

for(int i=0;i<list.size();i++){
if(list.get(i)!=null){
jo=JSONObject.fromObject(roomProxy.GetProperty(list.get(i)));
result=result+jo.toString();
}
if(i>0&&i<list.size()){
result=result+",";
}
}


return result+"]} ";
}

public RoomProxy getRoomProxy() {
return roomProxy;
}

public void setRoomProxy(RoomProxy roomProxy) {
this.roomProxy = roomProxy;
}

public JSONObject getJo() {
return jo;
}

public void setJo(JSONObject jo) {
this.jo = jo;
}

public String getResult() {
return result;
}

public void setResult(String result) {
this.result = result;
}

}




目的是想用 jquery的datagrid 中table 的URL 直接呈现结果 有其他方法也可以介绍给,越详细越好!
...全文
157 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

23,404

社区成员

发帖
与我相关
我的任务
社区描述
Java 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧