解决方案 »

  1.   


    String data="[{\"judge\":"+content+"}]";
      

  2.   

    你这种对于普通变量行得通,但是变量是FckEditor类型的,里面的格式就像:
    <h3><font color="blue">这里是数据测试</font></h3>
    <p>sdf </p>这样是通不过的!
      

  3.   

    FckEditor类型 是什么类型????
      

  4.   

    http://jiangzhengjun.iteye.com/blog/841307看看可以解决
      

  5.   

    就是下载的一个文本编辑器,就像这个回复框一样,可以对文中进行编辑,也可以插入图片。获取的时候会有HTML标签,于是导致不好转化为json格式的数据,所以不能传过去!
      

  6.   


    他只是过滤特殊字符 ,写个公用的方法 。你的字符串都扔进去过滤一下,在放到json里就行
      

  7.   

    搞不懂楼主,这根什么特殊字符有什么关系,你直接String data="[{\"judge\":"+content+"}]";
    这个content都是个字符串了,特殊字符又怎么了都在字符串里了,关特殊字符什么事
      

  8.   


    他只是过滤特殊字符 ,写个公用的方法 。你的字符串都扔进去过滤一下,在放到json里就行嗯,我知道,就是感觉挺麻烦的,谢谢你了!
      

  9.   

    写个代码你看看:String content =new String("<h3><font color="blue">这里是数据测试</font></h3><p>sdf </p>");
    String data="[{\"judge\":"+content+"}]";
    你觉得将上面的data能以json的格式传过去吗?
      

  10.   


    你要ajax输出给客户端?这样的话你用json-lib就是了
                    response.setContentType("application/json;charset=utf-8");
    PrintWriter pw=response.getWriter();
    String content ="<h3><font color=\"blue\">这里是数据测试</font></h3><p>sdf </p>";
    JSONObject jo=new JSONObject();
    jo.accumulate("judge", content);
    JSONArray ja=new JSONArray();
    ja.add(jo);
    pw.write(ja.toString());
    pw.flush();
    pw.close();
      

  11.   

    直接工具转,或者 手动改为json的格式。
      

  12.   

    你要ajax输出给客户端?这样的话你用json-lib就是了
                    response.setContentType("application/json;charset=utf-8");
    PrintWriter pw=response.getWriter();
    String content ="<h3><font color=\"blue\">这里是数据测试</font></h3><p>sdf </p>";
    JSONObject jo=new JSONObject();
    jo.accumulate("judge", content);
    JSONArray ja=new JSONArray();
    ja.add(jo);
    pw.write(ja.toString());
    pw.flush();
    pw.close();非常霸气,我以前一直想用工具就是不知道工具的使用具体方法,刚刚用了一下,行得通,非常感谢!
      

  13.   

    gson-1.7.1.jar这个jar推荐使用,可以用来转josn字符串的比json-lib-2.2.2-jdk15.jar给力一点~
      

  14.   

    你要ajax输出给客户端?这样的话你用json-lib就是了
                    response.setContentType("application/json;charset=utf-8");
    PrintWriter pw=response.getWriter();
    String content ="<h3><font color=\"blue\">这里是数据测试</font></h3><p>sdf </p>";
    JSONObject jo=new JSONObject();
    jo.accumulate("judge", content);
    JSONArray ja=new JSONArray();
    ja.add(jo);
    pw.write(ja.toString());
    pw.flush();
    pw.close();但是刚刚发现这么用的话,前台的回调函数无法回调成功啊!
      

  15.   

    你要ajax输出给客户端?这样的话你用json-lib就是了
                    response.setContentType("application/json;charset=utf-8");
    PrintWriter pw=response.getWriter();
    String content ="<h3><font color=\"blue\">这里是数据测试</font></h3><p>sdf </p>";
    JSONObject jo=new JSONObject();
    jo.accumulate("judge", content);
    JSONArray ja=new JSONArray();
    ja.add(jo);
    pw.write(ja.toString());
    pw.flush();
    pw.close();但是刚刚发现这么用的话,前台的回调函数无法回调成功啊!其实是我自己的代码写错了,木事木事!
      

  16.   

    难道楼主还手动处理json不成?
    后端json.net
    前端json2
    表示接触ajax&json以来,就没手写过json