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}}
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
{
}
Response.End();
}
public class UploadResponse
{
public int status { get; set; }
public string page_id { get; set; }
public object question { get; set; }
}
public bool IsReusable
{
get
{
return false;
}
}
}
}
,那上面的 _id={$oid="526b168189c0971b820a6fea"}格式怎么设定呢,类似于jumpconstraint_id_list=[]这种的又怎么设置呢?
public class Question
{
public object _id { get; set; }
public object custom_attr { get; set; }
public bool has_open_option { get; set; }
}