你的分享就是我们的动力 ---﹥

用jsp可能asp应该怎样写个接口 小白一个 求指导

用jsp或者asp应该怎样写个接口 小白一个 求指导
用jsp或者asp应该怎样写个接口 具体功能是可以访问数据库,将查询的数据转换成json数据, 然后可以用ajax 对该json数据与客户端可以进行交互, 我现在用asp可以连接了数据库,可以查询,但是不知道怎样将数据转换成json类型,求大神们解救一下
------解决思路----------------------
把数据拼接成字符串输出就行了 格式
------解决思路----------------------
protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        response.setCharacterEncoding("utf-8");
        String id =request.getParameter("id");
        String text  = "({bbs:";
        String callback = request.getParameter("jsoncallback");
        if(id!=null){
            String sql = "select a.id,a.subsite_id,a.type_id,a.parentid,a.UID,a.title,a.content,a.Small_img,a.author,a.source,a.is_display,a.is_url,a.is_pic,a.is_hot,a.focos,a.click,a.reply,a.`addtime`,a.fir_type,a.article_order,a.robot,a.zan,a.ju,a.duo,a.compid,a.did,b.id,b.categoryname " +
                    "from qs_bbs a,qs_bbs_category b " +
                    "where a.type_id=b.id and a.id='"+id+"'";
            Connection conn = DBConnection.getConnection();
            System.out.println("bbs-----------"+sql);           
            try {
                Statement stmt = conn.createStatement();
                ResultSet rs = stmt.executeQuery(sql);
                while(rs.next()){
                    text = text+"{id:'"+rs.getString(1)+
                                "',subsite_id:'"+rs.getString(2)+
                                "',type_id:'"+rs.getString(3)+
                                "',parentid:'"+rs.getString(4)+
                                "',UID:'"+rs.getString(5)+
                                "',title:'"+rs.getString(6)+
                                "',content:'"+rs.getString(7)+
                                "',Small_img:'"+rs.getString(8)+
                                "',author:'"+rs.getString(9)+
                                "',source:'"+rs.getString(10)+
                                "',is_display:'"+rs.getString(11)+
                                "',is_url:'"+rs.getString(12)+
                                "',is_pic:'"+rs.getString(13)+
                                "',is_hot:'"+rs.getString(14)+
                                "',focos:'"+rs.getString(15)+
                                "',click:'"+rs.getString(16)+
                                "',reply:'"+rs.getString(17)+
                                "',addtime:'"+DateType.dateStringmon(rs.getLong(18))+
                                "',fir_type:'"+rs.getString(19)+
                                "',article_order:'"+rs.getString(20)+
                                "',robot:'"+rs.getString(21)+
                                "',zan:'"+rs.getString(22)+
                                "',ju:'"+rs.getString(23)+
                                "',duo:'"+rs.getString(24)+
                                "',compid:'"+rs.getString(25)+
                                "',did:'"+rs.getString(26)+
                                "',bid:'"+rs.getString(27)+
                                "',categoryname:'"+rs.getString(28)+                       
                                "'}";
                }
                text=text+"})";
                conn.close();
            } catch (Exception e) {
                e.printStackTrace();
            }       
            System.out.println(text);       
            text=keyChange.htmlChang(text);       
            response.getWriter().write(callback+text);
        }else{
            System.out.println("id为空");
        }
    }