日期:2014-05-17  浏览次数:20499 次

json参数设置问题
本帖最后由 daijinhua 于 2013-10-26 11:25:56 编辑
需要输出的参数

page_id: "526a30e689c09768798a2338",

status :"200",

question:{ _id={$oid="526b168189c0971b820a6fea"},custom_attr={},has_open_option=false,jumpconstraint_id_list=[],matrixrow_id_list=[], option_id_list=['526b168189c0971b820a6feb','526b168189c0971b820a6fec'], option_list=[{_id={$oid="526b13d889c0971b4853104e"},cid="A1",custom_attr={text_row="1", text_col="20"},is_open=false,question_id="526b13d789c0971b4853104d",title="选项1",updated={$date=1382777944003}  }], project_id="526a30e689c09768798a2337",question_type=6,questionpage_id=52537aff89c09748bc880a42,title="填空题", updated={$date=1382777943968}}


ashx页面代码:

 private HttpRequest Request { get; set; }
        private HttpResponse Response { get; set; }
        JavaScriptSerializer jss = new JavaScriptSerializer();

        public void ProcessRequest(HttpContext context)
        {
            Request = context.Request;
            Response = context.Response;
            Response.ContentType = "text/html";
            Response.Expires = -1;

            try
            {
                //测试
                string ss = Request.Form["questionpage_id"];

                object resp = "{ _id={$oid=\"526b168189c0971b820a6fea\"},custom_attr={},has_open_option=false,jumpconstraint_id_list=[],matrixrow_id_list=[], option_id_list=['526b168189c0971b820a6feb','526b168189c0971b820a6fec'], option_list=[{_id={$oid=\"526b13d889c0971b4853104e\"},cid=\"A1\",custom_attr={text_row=\"1\", text_col=\"20\"},is_open=false,question_id=\"526b13d789c0971b4853104d\",title=\"选项1\",updated={$date=1382777944003}  }], project_id=\"526a30e689c09768798a2337\",question_type=6,questionpage_id=52537aff89c09748bc880a42,title=\"填空题\", updated={$date=1382777943968}}";
               
                var strB = new UploadResponse() { status = 200, page_id = ss, question = resp };
                
                Response.Write(jss.Serialize(strB));
            }
            catch
            {

            }